nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at litex 46 lines 1.1 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchurl, 5 readline, 6 enableCurrenciesUpdater ? true, 7 pythonPackages ? null 8}: 9 10assert enableCurrenciesUpdater -> pythonPackages != null; 11 12let pythonEnv = pythonPackages.python.withPackages(ps: [ 13 ps.requests 14 ]); 15in stdenv.mkDerivation rec { 16 pname = "units"; 17 version = "2.22"; 18 19 src = fetchurl { 20 url = "mirror://gnu/units/${pname}-${version}.tar.gz"; 21 sha256 = "sha256-XRPhIHch/ncm2Qa6HZLcDt2qn8JnWe0i47jRp5MSWEg="; 22 }; 23 24 buildInputs = [ readline ] 25 ++ lib.optionals enableCurrenciesUpdater [ 26 pythonEnv 27 ] 28 ; 29 prePatch = lib.optionalString enableCurrenciesUpdater '' 30 substituteInPlace units_cur \ 31 --replace "#!/usr/bin/env python" ${pythonEnv}/bin/python 32 ''; 33 postInstall = '' 34 cp units_cur ${placeholder "out"}/bin/ 35 ''; 36 37 doCheck = true; 38 39 meta = with lib; { 40 description = "Unit conversion tool"; 41 homepage = "https://www.gnu.org/software/units/"; 42 license = [ licenses.gpl3Plus ]; 43 platforms = platforms.all; 44 maintainers = [ maintainers.vrthra ]; 45 }; 46}