From c7383cb34b749306552b13f27a9f5edcebbd90ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Tue, 19 Jan 2016 11:17:49 +0100 Subject: [PATCH] fetchurl: support executables --- pkgs/build-support/fetchurl/builder.sh | 5 +++++ pkgs/build-support/fetchurl/default.nix | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/fetchurl/builder.sh b/pkgs/build-support/fetchurl/builder.sh index 29565d7cdb9a..c4fd18e46caf 100644 --- a/pkgs/build-support/fetchurl/builder.sh +++ b/pkgs/build-support/fetchurl/builder.sh @@ -45,6 +45,11 @@ tryDownload() { finish() { set +o noglob + + if [[ $executable == "1" ]]; then + chmod +x $downloadedFile + fi + runHook postFetch stopNest exit 0 diff --git a/pkgs/build-support/fetchurl/default.nix b/pkgs/build-support/fetchurl/default.nix index b1dc6e7be31b..804974954d10 100644 --- a/pkgs/build-support/fetchurl/default.nix +++ b/pkgs/build-support/fetchurl/default.nix @@ -73,6 +73,9 @@ in # is communicated to postFetch via $downloadedFile. downloadToTemp ? false +, # If true, set executable bit on downloaded file + executable ? false + , # If set, don't download the file, but write a list of all possible # URLs (resulting from resolving mirror:// URLs) to $out. showURLs ? false @@ -116,9 +119,9 @@ if (!hasHash) then throw "Specify hash for fetchurl fixed-output derivation: ${s outputHash = if outputHash != "" then outputHash else if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5; - outputHashMode = if recursiveHash then "recursive" else "flat"; + outputHashMode = if (recursiveHash || executable) then "recursive" else "flat"; - inherit curlOpts showURLs mirrorsFile impureEnvVars postFetch downloadToTemp; + inherit curlOpts showURLs mirrorsFile impureEnvVars postFetch downloadToTemp executable; # Doing the download on a remote machine just duplicates network # traffic, so don't do that.