2019-09-28 13:19:13 +00:00
|
|
|
{
|
|
|
|
stdenv,
|
|
|
|
lib,
|
|
|
|
fetchurl,
|
|
|
|
readline,
|
|
|
|
enableCurrenciesUpdater ? true,
|
|
|
|
pythonPackages ? null
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert enableCurrenciesUpdater -> pythonPackages != null;
|
2015-12-14 17:27:31 +00:00
|
|
|
|
2015-10-20 07:38:25 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "units";
|
2022-09-08 05:48:33 +00:00
|
|
|
version = "2.22";
|
2007-06-20 15:15:51 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-08-15 12:41:18 +00:00
|
|
|
url = "mirror://gnu/units/${pname}-${version}.tar.gz";
|
2022-09-08 05:48:33 +00:00
|
|
|
sha256 = "sha256-XRPhIHch/ncm2Qa6HZLcDt2qn8JnWe0i47jRp5MSWEg=";
|
2007-06-20 15:15:51 +00:00
|
|
|
};
|
2007-06-26 11:49:45 +00:00
|
|
|
|
2019-09-28 13:19:13 +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/
|
|
|
|
'';
|
2015-12-14 17:27:31 +00:00
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2013-10-06 09:49:53 +00:00
|
|
|
description = "Unit conversion tool";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://www.gnu.org/software/units/";
|
2015-12-14 17:27:31 +00:00
|
|
|
license = [ licenses.gpl3Plus ];
|
2016-06-23 07:03:59 +00:00
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = [ maintainers.vrthra ];
|
2007-06-26 11:49:45 +00:00
|
|
|
};
|
2007-06-20 15:15:51 +00:00
|
|
|
}
|