Change:
I was trying to download something that required that I put a token to the header. That has to be quoted mind you. Then I got these errors: Then it tries to download what's in the url, but It can't because that token authorizes it. Clearly not what I wanted :) Please run and paste the results. system: host os: multi-user?: sandbox: version: channels(root): nixpkgs: cc
This seems difficult to support. You could use or (e.g. ) instead.
I honestly think someone would expect this to just work like that. Perhaps there should be a note somewhere, if no one is interested in supporting this, that you cannot use quoted args here. Either of those are a workaround for me at least :+1: . But there could be more complex times when this isn't enough.
Actually you can use such quoted args only in scripts (e.g. or ). This could be made to work with Nix 2 and its structured attributes feature (even while maintaining compatibility with Nix 1):
Thank you for your contributions. This has been automatically marked as stale because it has had no activity for 180 days. If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity. Here are suggestions that might help resolve this more quickly: for maintainers and people that previously touched the related code and @ mention them in a comment. on the . on the on .
I believe this can still be implemented, and would be better than the current solution of writeText.
I just had this need in svanderburg/node2nix. The file workaround worked, but it took a very very long time to find this issue.
I marked this as stale due to inactivity. &rarr;
still an issue and why it is difficult to support? looks like a trivial bug
I marked this as stale due to inactivity. &rarr;

Discussion:
curl+=(--insecure) fi <ins> eval "curl+=($curlOptsList)" </ins> curl+=( $curlOpts $NIX_CURL_FLAGS

urls ? [] , # Additional curl options needed for the download to succeed. <ins> # Warning: Each space (no matter the escaping) will start a new argument. # If you wish to pass arguments with spaces, use `curlOptsList` </ins> curlOpts ? "" <ins> , # Additional curl options needed for the download to succeed. curlOptsList ? [] </ins> , # Name of the file.  If empty, use the basename of `url' (or of the # first element of `urls'). name ? ""

outputHashMode = if (recursiveHash || executable) then "recursive" else "flat"; <del> inherit curlOpts showURLs mirrorsFile postFetch downloadToTemp executable; </del> <ins> 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; curlOptsList = lib.escapeShellArgs curlOptsList; inherit showURLs mirrorsFile postFetch downloadToTemp executable; </ins> impureEnvVars = impureEnvVars ++ netrcImpureEnvVars;

<ins> { invalidateFetcherByDrvHash, fetchurl, jq, moreutils, ... }: { # Tests that we can send custom headers with spaces in them header = let headerValue = "Test '" <- These are some quotes"; in invalidateFetcherByDrvHash fetchurl { url = "https://httpbin.org/headers"; sha256 = builtins.hashString "sha256" (headerValue + "n"); curlOptsList = [ "-H" "Hello: ${headerValue}" ]; postFetch = '' ${jq}/bin/jq -r '.headers.Hello' $out | ${moreutils}/bin/sponge $out ''; }; } </ins>

(lib.overrideDerivation (fetchurl { inherit name url sha256; <del> curlOpts = [ </del> <ins> curlOptsList = [ </ins> "--get" "--data-urlencode" "username@username" "--data-urlencode" "token@token"

cc-multilib-gcc = callPackage ./cc-wrapper/multilib.nix { stdenv = gccMultiStdenv; }; cc-multilib-clang = callPackage ./cc-wrapper/multilib.nix { stdenv = clangMultiStdenv; }; <ins> fetchurl = callPackages ../build-support/fetchurl/tests.nix { }; </ins> fetchpatch = callPackages ../build-support/fetchpatch/tests.nix { }; fetchgit = callPackages ../build-support/fetchgit/tests.nix { }; fetchFirefoxAddon = callPackages ../build-support/fetchfirefoxaddon/tests.nix { };