about summary refs log tree commit diff
path: root/nixpkgs/pkgs/build-support/fetchurl/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-08-26 09:19:25 +0000
committerAlyssa Ross <hi@alyssa.is>2023-08-26 09:19:25 +0000
commit55abc327b49b4097e48c916e40803caa8cf46e8f (patch)
tree1c0420ab3fb21d9485460b912f1c3eae18781871 /nixpkgs/pkgs/build-support/fetchurl/default.nix
parent7936cf821dccc1eaade44b852db09d03fae8e5f3 (diff)
parent18324978d632ffc55ef1d928e81630c620f4f447 (diff)
downloadnixlib-55abc327b49b4097e48c916e40803caa8cf46e8f.tar
nixlib-55abc327b49b4097e48c916e40803caa8cf46e8f.tar.gz
nixlib-55abc327b49b4097e48c916e40803caa8cf46e8f.tar.bz2
nixlib-55abc327b49b4097e48c916e40803caa8cf46e8f.tar.lz
nixlib-55abc327b49b4097e48c916e40803caa8cf46e8f.tar.xz
nixlib-55abc327b49b4097e48c916e40803caa8cf46e8f.tar.zst
nixlib-55abc327b49b4097e48c916e40803caa8cf46e8f.zip
Merge branch 'nixos-unstable' of https://github.com/NixOS/nixpkgs
Conflicts:
	nixpkgs/pkgs/build-support/go/module.nix
Diffstat (limited to 'nixpkgs/pkgs/build-support/fetchurl/default.nix')
-rw-r--r--nixpkgs/pkgs/build-support/fetchurl/default.nix14
1 files changed, 8 insertions, 6 deletions
diff --git a/nixpkgs/pkgs/build-support/fetchurl/default.nix b/nixpkgs/pkgs/build-support/fetchurl/default.nix
index bcab54e273dc..d1a886a34a70 100644
--- a/nixpkgs/pkgs/build-support/fetchurl/default.nix
+++ b/nixpkgs/pkgs/build-support/fetchurl/default.nix
@@ -132,6 +132,13 @@ let
     else throw "fetchurl requires a hash for fixed-output derivation: ${lib.concatStringsSep ", " urls_}";
 in
 
+assert (lib.isList curlOpts) -> lib.warn ''
+    fetchurl for ${toString (builtins.head urls_)}: curlOpts is a list (${lib.generators.toPretty { multiline = false; } curlOpts}), which is not supported anymore.
+    - If you wish to get the same effect as before, for elements with spaces (even if escaped) to expand to multiple curl arguments, use a string argument instead:
+      curlOpts = ${lib.strings.escapeNixString (toString curlOpts)};
+    - If you wish for each list element to be passed as a separate curl argument, allowing arguments to contain spaces, use curlOptsList instead:
+      curlOptsList = [ ${lib.concatMapStringsSep " " lib.strings.escapeNixString curlOpts} ];'' true;
+
 stdenvNoCC.mkDerivation ((
   if (pname != "" && version != "") then
     { inherit pname version; }
@@ -161,12 +168,7 @@ stdenvNoCC.mkDerivation ((
 
   outputHashMode = if (recursiveHash || executable) then "recursive" else "flat";
 
-  curlOpts = lib.warnIf (lib.isList curlOpts) ''
-    fetchurl for ${toString (builtins.head urls_)}: curlOpts is a list (${lib.generators.toPretty { multiline = false; } curlOpts}), which is not supported anymore.
-    - If you wish to get the same effect as before, for elements with spaces (even if escaped) to expand to multiple curl arguments, use a string argument instead:
-      curlOpts = ${lib.strings.escapeNixString (toString curlOpts)};
-    - If you wish for each list element to be passed as a separate curl argument, allowing arguments to contain spaces, use curlOptsList instead:
-      curlOptsList = [ ${lib.concatMapStringsSep " " lib.strings.escapeNixString curlOpts} ];'' curlOpts;
+  inherit curlOpts;
   curlOptsList = lib.escapeShellArgs curlOptsList;
   inherit showURLs mirrorsFile postFetch downloadToTemp executable;