fetchzip: add pname+version support

+14 -3
+14 -3
pkgs/build-support/fetchzip/default.nix
··· 14 14 , extraPostFetch ? "" 15 15 , postFetch ? "" 16 16 , name ? "source" 17 + , pname ? "" 18 + , version ? "" 17 19 , nativeBuildInputs ? [ ] 18 20 , # Allows to set the extension for the intermediate downloaded 19 21 # file. This can be used as a hint for the unpackCmdHooks to select ··· 23 25 24 26 25 27 lib.warnIf (extraPostFetch != "") "use 'postFetch' instead of 'extraPostFetch' with 'fetchzip' and 'fetchFromGitHub'." 26 - (fetchurl (let 28 + 29 + (let 27 30 tmpFilename = 28 31 if extension != null 29 32 then "download.${extension}" 30 33 else baseNameOf (if url != "" then url else builtins.head urls); 31 - in { 32 - inherit name; 34 + in 33 35 36 + fetchurl (( 37 + if (pname != "" && version != "") then 38 + { 39 + name = "${name}-${version}"; 40 + inherit pname version; 41 + } 42 + else 43 + { inherit name; } 44 + ) // { 34 45 recursiveHash = true; 35 46 36 47 downloadToTemp = true;