ledger-web: we have bundlerEnv, let us use it

This commit is contained in:
Peter Hoeg 2016-09-07 11:06:50 +08:00
parent 7949e69382
commit 222d084927

View file

@ -1,48 +1,25 @@
{ stdenv, lib, fetchFromGitHub, bundlerEnv, ruby
{ lib, bundlerEnv, ruby
, withPostgresql ? true, postgresql
, withSqlite ? false, sqlite
}:
let
_name = "ledger-web";
cmd = "ledger_web";
bundlerEnv rec {
name = "ledger-web-${version}";
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;
};
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;
};
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}
'';
}