summary refs log tree commit diff
diff options
context:
space:
mode:
authorSandro Jäckel <sandro.jaeckel@sap.com>2022-10-04 17:30:18 +0200
committerSandro Jäckel <sandro.jaeckel@sap.com>2022-10-04 18:57:46 +0200
commit01dfd3cb5827a190e90c2627f4a1714b9deda4af (patch)
treedc4809f0b185c0084f7449bd2698f5f817336b30
parent7deac8b8f703702d8ec68490dc2be2301696be8a (diff)
downloadnixpkgs-01dfd3cb5827a190e90c2627f4a1714b9deda4af.tar
nixpkgs-01dfd3cb5827a190e90c2627f4a1714b9deda4af.tar.gz
nixpkgs-01dfd3cb5827a190e90c2627f4a1714b9deda4af.tar.bz2
nixpkgs-01dfd3cb5827a190e90c2627f4a1714b9deda4af.tar.lz
nixpkgs-01dfd3cb5827a190e90c2627f4a1714b9deda4af.tar.xz
nixpkgs-01dfd3cb5827a190e90c2627f4a1714b9deda4af.tar.zst
nixpkgs-01dfd3cb5827a190e90c2627f4a1714b9deda4af.zip
fetchzip: add pname+version support
-rw-r--r--pkgs/build-support/fetchzip/default.nix17
1 files changed, 14 insertions, 3 deletions
diff --git a/pkgs/build-support/fetchzip/default.nix b/pkgs/build-support/fetchzip/default.nix
index 10142134792..9c08276cdb9 100644
--- a/pkgs/build-support/fetchzip/default.nix
+++ b/pkgs/build-support/fetchzip/default.nix
@@ -14,6 +14,8 @@
 , extraPostFetch ? ""
 , postFetch ? ""
 , name ? "source"
+, pname ? ""
+, version ? ""
 , nativeBuildInputs ? [ ]
 , # Allows to set the extension for the intermediate downloaded
   # file. This can be used as a hint for the unpackCmdHooks to select
@@ -23,14 +25,23 @@
 
 
 lib.warnIf (extraPostFetch != "") "use 'postFetch' instead of 'extraPostFetch' with 'fetchzip' and 'fetchFromGitHub'."
-(fetchurl (let
+
+(let
   tmpFilename =
     if extension != null
     then "download.${extension}"
     else baseNameOf (if url != "" then url else builtins.head urls);
-in {
-  inherit name;
+in
 
+fetchurl ((
+  if (pname != "" && version != "") then
+    {
+      name = "${name}-${version}";
+      inherit pname version;
+    }
+  else
+    { inherit name; }
+) // {
   recursiveHash = true;
 
   downloadToTemp = true;