diff --git a/pkgs/tools/misc/units/default.nix b/pkgs/tools/misc/units/default.nix index 04e955a78b189..ebfd913de217d 100644 --- a/pkgs/tools/misc/units/default.nix +++ b/pkgs/tools/misc/units/default.nix @@ -9,7 +9,10 @@ assert enableCurrenciesUpdater -> pythonPackages != null; -stdenv.mkDerivation rec { +let pythonEnv = pythonPackages.python.withPackages(ps: [ + ps.requests + ]); +in stdenv.mkDerivation rec { pname = "units"; version = "2.21"; @@ -18,16 +21,12 @@ stdenv.mkDerivation rec { sha256 = "sha256-bD6AqfmAWJ/ZYqWFKiZ0ZCJX2xxf1bJ8TZ5mTzSGy68="; }; - pythonEnv = pythonPackages.python.withPackages(ps: [ - ps.requests - ]); - buildInputs = [ readline ] ++ lib.optionals enableCurrenciesUpdater [ pythonEnv ] ; - prePatch = '' + prePatch = lib.optionalString enableCurrenciesUpdater '' substituteInPlace units_cur \ --replace "#!/usr/bin/env python" ${pythonEnv}/bin/python '';