<commit_before>{ stdenv, lib, fetchFromGitHub, bundlerEnv, ruby
, withPostgresql ? true, postgresql
, withSqlite ? false, sqlite
}:

let
  _name = "ledger-web";
  cmd = "ledger_web";

  env = bundlerEnv {
    name = "${_name}-env";
    inherit ruby;
    gemfile = ./Gemfile;
    lockfile = ./Gemfile.lock;
    gemset = ./gemset.nix;
    meta = with lib; {
      homepage = https://github.com/peterkeen/ledger-web;
      platforms = platforms.linux;
      maintainers = [ peterhoeg ];
      license = licenses.mit;
    };
  };

in stdenv.mkDerivation rec {
  name = "${_name}-${version}";
  version = "1.5.2";

  buildInputs = [ env ruby ]
    ++ lib.optional withPostgresql postgresql
    ++ lib.optional withSqlite sqlite;

  src = fetchFromGitHub {
    owner = "peterkeen";
    repo = _name;
    rev = "v${version}";
    sha256 = "0an4d46h3pp7a8s96jl0dnw1imwdgnb2j474b9wrbidwc6cmfrm7";
  };

  dontStrip = true;

  installPhase = ''
    mkdir -p $out/bin

    cp --no-preserve=mode -r lib $out

    ln -s ${env}/bin/${cmd} $out/bin/${cmd}
  '';
}<commit_msg>ledger-web: we have bundlerEnv, let us use it<commit_after>{ lib, bundlerEnv, ruby
, withPostgresql ? true, postgresql
, withSqlite ? false, sqlite
}:

bundlerEnv rec {
  name = "ledger-web-${version}";

  version = (import gemset).ledger_web.version;
  inherit ruby;
  gemfile = ./Gemfile;
  lockfile = ./Gemfile.lock;
  gemset = ./gemset.nix;

  buildInputs =    lib.optional withPostgresql postgresql
                ++ lib.optional withSqlite sqlite;

  meta = with lib; {
    description = "A web frontend to the Ledger CLI tool";
    homepage = https://github.com/peterkeen/ledger-web;
    license = licenses.mit;
    maintainers = with maintainers; [ peterhoeg ];
    platforms = platforms.linux;
  };
}
{'fraction_non_alphanumeric': 0.13728813559322034, 'fraction_numerical': 0.013559322033898305, 'mean_word_length': 2.953125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4250967', 'n_tokens_mistral': 670, 'n_tokens_neox': 641, 'n_words': 142}