fetchurl: add pname+version support
This commit is contained in:
parent
fc95752d6f
commit
7deac8b8f7
|
@ -57,6 +57,11 @@ in
|
||||||
# first element of `urls').
|
# first element of `urls').
|
||||||
name ? ""
|
name ? ""
|
||||||
|
|
||||||
|
# for versioned downloads optionally take pname + version.
|
||||||
|
# if name is set that is preferred
|
||||||
|
, pname ? ""
|
||||||
|
, version ? ""
|
||||||
|
|
||||||
, # SRI hash.
|
, # SRI hash.
|
||||||
hash ? ""
|
hash ? ""
|
||||||
|
|
||||||
|
@ -130,12 +135,16 @@ let
|
||||||
else throw "fetchurl requires a hash for fixed-output derivation: ${lib.concatStringsSep ", " urls_}";
|
else throw "fetchurl requires a hash for fixed-output derivation: ${lib.concatStringsSep ", " urls_}";
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenvNoCC.mkDerivation {
|
stdenvNoCC.mkDerivation ((
|
||||||
name =
|
if (pname != "" && version != "") then
|
||||||
if showURLs then "urls"
|
{ inherit pname version; }
|
||||||
else if name != "" then name
|
else
|
||||||
else baseNameOf (toString (builtins.head urls_));
|
{ name =
|
||||||
|
if showURLs then "urls"
|
||||||
|
else if name != "" then name
|
||||||
|
else baseNameOf (toString (builtins.head urls_));
|
||||||
|
}
|
||||||
|
) // {
|
||||||
builder = ./builder.sh;
|
builder = ./builder.sh;
|
||||||
|
|
||||||
nativeBuildInputs = [ curl ] ++ nativeBuildInputs;
|
nativeBuildInputs = [ curl ] ++ nativeBuildInputs;
|
||||||
|
@ -177,4 +186,4 @@ stdenvNoCC.mkDerivation {
|
||||||
|
|
||||||
inherit meta;
|
inherit meta;
|
||||||
passthru = { inherit url; } // passthru;
|
passthru = { inherit url; } // passthru;
|
||||||
}
|
})
|
||||||
|
|
Loading…
Reference in a new issue