diff options
Diffstat (limited to 'nixpkgs/pkgs/build-support/fetchzip/default.nix')
-rw-r--r-- | nixpkgs/pkgs/build-support/fetchzip/default.nix | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/nixpkgs/pkgs/build-support/fetchzip/default.nix b/nixpkgs/pkgs/build-support/fetchzip/default.nix index cde4d4f579f4..b174c252fc0e 100644 --- a/nixpkgs/pkgs/build-support/fetchzip/default.nix +++ b/nixpkgs/pkgs/build-support/fetchzip/default.nix @@ -13,10 +13,17 @@ , urls ? [] , extraPostFetch ? "" , name ? "source" +, # Allows to set the extension for the intermediate downloaded + # file. This can be used as a hint for the unpackCmdHooks to select + # an appropriate unpacking tool. + extension ? null , ... } @ args: (fetchurl (let - basename = baseNameOf (if url != "" then url else builtins.head urls); + tmpFilename = + if extension != null + then "download.${extension}" + else baseNameOf (if url != "" then url else builtins.head urls); in { inherit name; @@ -30,7 +37,7 @@ in { mkdir "$unpackDir" cd "$unpackDir" - renamed="$TMPDIR/${basename}" + renamed="$TMPDIR/${tmpFilename}" mv "$downloadedFile" "$renamed" unpackFile "$renamed" '' @@ -56,7 +63,7 @@ in { + '' chmod 755 "$out" ''; -} // removeAttrs args [ "stripRoot" "extraPostFetch" ])).overrideAttrs (x: { +} // removeAttrs args [ "stripRoot" "extraPostFetch" "extension" ])).overrideAttrs (x: { # Hackety-hack: we actually need unzip hooks, too nativeBuildInputs = x.nativeBuildInputs ++ [ unzip ]; }) |