summary refs log tree commit diff
path: root/pkgs/build-support/fetchzip
diff options
context:
space:
mode:
authorSandro Jäckel <sandro.jaeckel@gmail.com>2021-04-05 03:40:16 +0200
committerSandro Jäckel <sandro.jaeckel@gmail.com>2021-04-07 02:41:25 +0200
commit9f78dd4a1cb4b20c820ed98c7a69e9c6534fff71 (patch)
tree6d19636fa8625af6a9f8a939a1c896a26d8dd621 /pkgs/build-support/fetchzip
parent60d4ac8280338495f03803628a49cf042cbabfa6 (diff)
downloadnixpkgs-9f78dd4a1cb4b20c820ed98c7a69e9c6534fff71.tar
nixpkgs-9f78dd4a1cb4b20c820ed98c7a69e9c6534fff71.tar.gz
nixpkgs-9f78dd4a1cb4b20c820ed98c7a69e9c6534fff71.tar.bz2
nixpkgs-9f78dd4a1cb4b20c820ed98c7a69e9c6534fff71.tar.lz
nixpkgs-9f78dd4a1cb4b20c820ed98c7a69e9c6534fff71.tar.xz
nixpkgs-9f78dd4a1cb4b20c820ed98c7a69e9c6534fff71.tar.zst
nixpkgs-9f78dd4a1cb4b20c820ed98c7a69e9c6534fff71.zip
fetchzip: accept urls
Required after 9bbfb268540e0cc0404a6b9ef33ea3bf160066ed
Diffstat (limited to 'pkgs/build-support/fetchzip')
-rw-r--r--pkgs/build-support/fetchzip/default.nix11
1 files changed, 7 insertions, 4 deletions
diff --git a/pkgs/build-support/fetchzip/default.nix b/pkgs/build-support/fetchzip/default.nix
index b00983772e4..cde4d4f579f 100644
--- a/pkgs/build-support/fetchzip/default.nix
+++ b/pkgs/build-support/fetchzip/default.nix
@@ -5,16 +5,19 @@
 # (e.g. due to minor changes in the compression algorithm, or changes
 # in timestamps).
 
-{ fetchurl, unzip }:
+{ lib, fetchurl, unzip }:
 
 { # Optionally move the contents of the unpacked tree up one level.
   stripRoot ? true
-, url
+, url ? ""
+, urls ? []
 , extraPostFetch ? ""
 , name ? "source"
 , ... } @ args:
 
-(fetchurl ({
+(fetchurl (let
+  basename = baseNameOf (if url != "" then url else builtins.head urls);
+in {
   inherit name;
 
   recursiveHash = true;
@@ -27,7 +30,7 @@
       mkdir "$unpackDir"
       cd "$unpackDir"
 
-      renamed="$TMPDIR/${baseNameOf url}"
+      renamed="$TMPDIR/${basename}"
       mv "$downloadedFile" "$renamed"
       unpackFile "$renamed"
     ''