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