2020-04-24 23:36:52 +00:00
|
|
|
{
|
|
|
|
stdenv,
|
|
|
|
lib,
|
|
|
|
fetchurl,
|
|
|
|
readline,
|
|
|
|
enableCurrenciesUpdater ? true,
|
|
|
|
pythonPackages ? null
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert enableCurrenciesUpdater -> pythonPackages != null;
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "units";
|
2023-03-24 00:07:29 +00:00
|
|
|
version = "2.22";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://gnu/units/${pname}-${version}.tar.gz";
|
2023-03-24 00:07:29 +00:00
|
|
|
sha256 = "sha256-XRPhIHch/ncm2Qa6HZLcDt2qn8JnWe0i47jRp5MSWEg=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Unit conversion tool";
|
|
|
|
homepage = "https://www.gnu.org/software/units/";
|
|
|
|
license = [ licenses.gpl3Plus ];
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = [ maintainers.vrthra ];
|
|
|
|
};
|
|
|
|
}
|