Skip to content

Commit

Permalink
fetchurl: add user agent
Browse files Browse the repository at this point in the history
It would be nice to be able to track Nix requests. It's not trustworthy,
but can be helpful for stats and routing in HTTP logs.

Since `fetchurl` is used so widely, we should "magically" get a UA on
`fetchzip`, `fetchFromGitHub`, and other related fetchers.

Since `fetchurl` is only used for fixed-output derivations, this should
cause no mass rebuild.
  • Loading branch information
copumpkin committed Aug 15, 2016
1 parent de27f97 commit cfe35e9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkgs/build-support/fetchurl/builder.sh
Expand Up @@ -13,6 +13,7 @@ curl="curl \
--disable-epsv \
--cookie-jar cookies \
--insecure \
--user-agent "$userAgent" \
$curlOpts \
$NIX_CURL_FLAGS"

Expand Down
2 changes: 2 additions & 0 deletions pkgs/build-support/fetchurl/default.nix
Expand Up @@ -124,6 +124,8 @@ if (!hasHash) then throw "Specify hash for fetchurl fixed-output derivation: ${s

inherit curlOpts showURLs mirrorsFile impureEnvVars postFetch downloadToTemp executable;

userAgent = "Nix/${builtins.nixVersion}; nixpkgs/${stdenv.lib.nixpkgsVersion}";

# Doing the download on a remote machine just duplicates network
# traffic, so don't do that.
preferLocalBuild = true;
Expand Down

0 comments on commit cfe35e9

Please sign in to comment.