diff options
author | Doron Behar <doron.behar@gmail.com> | 2019-09-28 16:19:13 +0300 |
---|---|---|
committer | Doron Behar <doron.behar@gmail.com> | 2019-09-28 16:19:13 +0300 |
commit | c7f682a59a3bb8106caab1e4f7d2fcc5480ff554 (patch) | |
tree | 445bc285e53fdac38c10158d8ce2f9625533afa9 /pkgs/tools/misc/units | |
parent | 002f2bc1afc27ff4065943b8f905a7cf1f36616d (diff) |
units: Add units_cur python script to $out
Diffstat (limited to 'pkgs/tools/misc/units')
-rw-r--r-- | pkgs/tools/misc/units/default.nix | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/pkgs/tools/misc/units/default.nix b/pkgs/tools/misc/units/default.nix index 8f66f566aa7d0..8bea94770ba65 100644 --- a/pkgs/tools/misc/units/default.nix +++ b/pkgs/tools/misc/units/default.nix @@ -1,4 +1,13 @@ -{ stdenv, fetchurl, readline }: +{ + stdenv, + lib, + fetchurl, + readline, + enableCurrenciesUpdater ? true, + pythonPackages ? null +}: + +assert enableCurrenciesUpdater -> pythonPackages != null; stdenv.mkDerivation rec { pname = "units"; @@ -9,7 +18,22 @@ stdenv.mkDerivation rec { sha256 = "0mk562g7dnidjgfgvkxxpvlba66fh1ykmfd9ylzvcln1vxmi6qj2"; }; - buildInputs = [ readline ]; + pythonEnv = pythonPackages.python.withPackages(ps: [ + ps.requests + ]); + + buildInputs = [ readline ] + ++ lib.optionals enableCurrenciesUpdater [ + pythonEnv + ] + ; + prePatch = '' + substituteInPlace units_cur \ + --replace "#!/usr/bin/env python" ${pythonEnv}/bin/python + ''; + postInstall = '' + cp units_cur ${placeholder "out"}/bin/ + ''; doCheck = true; |