mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-18 19:51:17 +00:00
Merge pull request #290852 from atorres1985-contrib/units
units: 2.22 -> 2.23
This commit is contained in:
commit
52415bc3cf
70
pkgs/by-name/un/units/package.nix
Normal file
70
pkgs/by-name/un/units/package.nix
Normal file
|
@ -0,0 +1,70 @@
|
|||
{ lib
|
||||
, fetchurl
|
||||
, python3
|
||||
, readline
|
||||
, stdenv
|
||||
, enableCurrenciesUpdater ? true
|
||||
}:
|
||||
|
||||
let
|
||||
pythonEnv = python3.withPackages(p: [
|
||||
p.requests
|
||||
]);
|
||||
in stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "units";
|
||||
version = "2.23";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gnu/units/units-${finalAttrs.version}.tar.gz";
|
||||
hash = "sha256-2Ve0USRZJcnmFMRRM5dEljDq+SvWK4SVugm741Ghc3A=";
|
||||
};
|
||||
|
||||
outputs = [ "out" "info" "man" ];
|
||||
|
||||
buildInputs = [
|
||||
readline
|
||||
] ++ lib.optionals enableCurrenciesUpdater [
|
||||
pythonEnv
|
||||
];
|
||||
|
||||
prePatch = lib.optionalString enableCurrenciesUpdater ''
|
||||
substituteInPlace units_cur \
|
||||
--replace "#!/usr/bin/env python" ${pythonEnv}/bin/python
|
||||
'';
|
||||
|
||||
postInstall = lib.optionalString enableCurrenciesUpdater ''
|
||||
cp units_cur ${placeholder "out"}/bin/
|
||||
'';
|
||||
|
||||
doCheck = true;
|
||||
|
||||
meta = {
|
||||
homepage = "https://www.gnu.org/software/units/";
|
||||
description = "Unit conversion tool";
|
||||
longDescription = ''
|
||||
GNU Units converts quantities expressed in various systems of measurement
|
||||
to their equivalents in other systems of measurement. Like many similar
|
||||
programs, it can handle multiplicative scale changes. It can also handle
|
||||
nonlinear conversions such as Fahrenheit to Celsius or wire gauge, and it
|
||||
can convert from and to sums of units, such as converting between meters
|
||||
and feet plus inches.
|
||||
|
||||
Beyond simple unit conversions, GNU Units can be used as a general-purpose
|
||||
scientific calculator that keeps track of units in its calculations. You
|
||||
can form arbitrary complex mathematical expressions of dimensions
|
||||
including sums, products, quotients, powers, and even roots of
|
||||
dimensions. Thus you can ensure accuracy and dimensional consistency when
|
||||
working with long expressions that involve many different units that may
|
||||
combine in complex ways.
|
||||
|
||||
The units are defined in an external data file. You can use the extensive
|
||||
data file that comes with this program, or you can provide your own data
|
||||
file to suit your needs. You can also use your own data file to supplement
|
||||
the standard data file.
|
||||
'';
|
||||
license = with lib.licenses; [ gpl3Plus ];
|
||||
mainProgram = "units";
|
||||
maintainers = with lib.maintainers; [ AndersonTorres ];
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
})
|
|
@ -1,46 +0,0 @@
|
|||
{
|
||||
stdenv,
|
||||
lib,
|
||||
fetchurl,
|
||||
readline,
|
||||
enableCurrenciesUpdater ? true,
|
||||
pythonPackages ? null
|
||||
}:
|
||||
|
||||
assert enableCurrenciesUpdater -> pythonPackages != null;
|
||||
|
||||
let pythonEnv = pythonPackages.python.withPackages(ps: [
|
||||
ps.requests
|
||||
]);
|
||||
in stdenv.mkDerivation rec {
|
||||
pname = "units";
|
||||
version = "2.22";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gnu/units/${pname}-${version}.tar.gz";
|
||||
sha256 = "sha256-XRPhIHch/ncm2Qa6HZLcDt2qn8JnWe0i47jRp5MSWEg=";
|
||||
};
|
||||
|
||||
buildInputs = [ readline ]
|
||||
++ lib.optionals enableCurrenciesUpdater [
|
||||
pythonEnv
|
||||
]
|
||||
;
|
||||
prePatch = lib.optionalString enableCurrenciesUpdater ''
|
||||
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 ];
|
||||
platforms = platforms.all;
|
||||
maintainers = [ maintainers.vrthra ];
|
||||
};
|
||||
}
|
|
@ -14707,11 +14707,6 @@ with pkgs;
|
|||
inherit (darwin) cctools;
|
||||
};
|
||||
|
||||
units = callPackage ../tools/misc/units {
|
||||
enableCurrenciesUpdater = true;
|
||||
pythonPackages = python3Packages;
|
||||
};
|
||||
|
||||
unittest-cpp = callPackage ../development/libraries/unittest-cpp { };
|
||||
|
||||
unnaturalscrollwheels = callPackage ../tools/inputmethods/unnaturalscrollwheels { };
|
||||
|
|
Loading…
Reference in a new issue