3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/tools/misc/units/default.nix

48 lines
1,004 B
Nix
Raw Normal View History

{
stdenv,
lib,
fetchurl,
readline,
enableCurrenciesUpdater ? true,
pythonPackages ? null
}:
assert enableCurrenciesUpdater -> pythonPackages != null;
stdenv.mkDerivation rec {
pname = "units";
2021-03-09 22:38:01 +00:00
version = "2.21";
src = fetchurl {
url = "mirror://gnu/units/${pname}-${version}.tar.gz";
2021-03-09 22:38:01 +00:00
sha256 = "sha256-bD6AqfmAWJ/ZYqWFKiZ0ZCJX2xxf1bJ8TZ5mTzSGy68=";
};
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;
meta = with lib; {
description = "Unit conversion tool";
homepage = "https://www.gnu.org/software/units/";
license = [ licenses.gpl3Plus ];
2016-06-23 08:03:59 +01:00
platforms = platforms.all;
maintainers = [ maintainers.vrthra ];
};
}