git.iko.soy/typeable/nixpkgs
on master help sign in
lib/fetchers.nix: factor out impure proxy vars (#18702)

Apparently everyone just copied those variables, instead of creating a library constant for them. Some even removed the comment. -.-

commit61462c94e630cdfc6553eb9b0a0b0ad4f85f0b7a authorProfpatsch <mail@profpatsch.de> dateSat 17 Sep 2016, 21:50 (10 years ago) parentaa7ab01
14 files changed+29−72
lib/default.nix+2−1 lib/fetchers.nix+12 pkgs/applications/networking/browsers/chromium/update.nix+1−3 pkgs/applications/networking/cluster/chronos/chronos-deps.nix+1−5 pkgs/applications/networking/cluster/mesos/mesos-deps.nix+1−5 pkgs/build-support/docker/pull.nix+2−8 pkgs/build-support/fetchadc/default.nix−10 pkgs/build-support/fetchegg/default.nix+1−7 pkgs/build-support/fetchgit/default.nix+3−7 pkgs/build-support/fetchhg/default.nix+1−3 pkgs/build-support/fetchmtn/default.nix+2−7 pkgs/build-support/fetchsvn/default.nix+1−8 pkgs/build-support/fetchurl/default.nix+1−7 pkgs/build-support/rust/fetchcargo.nix+1−1
lib/default.nix+2−1
@@ -31,6 +31,7 @@ let
3131
3232 # domain-specific
3333 sandbox = import ./sandbox.nix;
34+ fetchers = import ./fetchers.nix;
3435
3536in
3637 { inherit trivial
@@ -39,7 +40,7 @@ in
3940 modules options types
4041 licenses platforms systems
4142 debug misc
42− sandbox;
43+ sandbox fetchers;
4344 }
4445 # !!! don't include everything at top-level; perhaps only the most
4546 # commonly used functions.
lib/fetchers.nixnew file+12
@@ -0,0 +1,12 @@
1+# snippets that can be shared by mutliple fetchers (pkgs/build-support)
2+{
3+
4+ proxyImpureEnvVars = [
5+ # We borrow these environment variables from the caller to allow
6+ # easy proxy configuration. This is impure, but a fixed-output
7+ # derivation like fetchurl is allowed to do so since its result is
8+ # by definition pure.
9+ "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
10+ ];
11+
12+}
pkgs/applications/networking/browsers/chromium/update.nix+1−3
@@ -157,9 +157,7 @@ in rec {
157157 fi
158158 '';
159159
160− impureEnvVars = [
161− "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
162− ];
160+ impureEnvVars = lib.fetchers.proxyImpureEnvVars;
163161 };
164162
165163 in {
pkgs/applications/networking/cluster/chronos/chronos-deps.nix+1−5
@@ -10,9 +10,5 @@ stdenv.mkDerivation {
1010
1111 buildInputs = [ curl ];
1212
13− # We borrow these environment variables from the caller to allow
14− # easy proxy configuration. This is impure, but a fixed-output
15− # derivation like fetchurl is allowed to do so since its result is
16− # by definition pure.
17− impureEnvVars = ["http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"];
13+ impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars;
1814}
pkgs/applications/networking/cluster/mesos/mesos-deps.nix+1−5
@@ -10,9 +10,5 @@ stdenv.mkDerivation {
1010
1111 buildInputs = [ curl ];
1212
13− # We borrow these environment variables from the caller to allow
14− # easy proxy configuration. This is impure, but a fixed-output
15− # derivation like fetchurl is allowed to do so since its result is
16− # by definition pure.
17− impureEnvVars = ["http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"];
13+ impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars;
1814}
pkgs/build-support/docker/pull.nix+2−8
@@ -26,17 +26,11 @@ let layer = stdenv.mkDerivation {
2626 outputHash = sha256;
2727 outputHashMode = "recursive";
2828
29− impureEnvVars = [
30− # We borrow these environment variables from the caller to allow
31− # easy proxy configuration. This is impure, but a fixed-output
32− # derivation like fetchurl is allowed to do so since its result is
33− # by definition pure.
34− "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
35−
29+ impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
3630 # This variable allows the user to pass additional options to curl
3731 "NIX_CURL_FLAGS"
3832 ];
39−
33+
4034 # Doing the download on a remote machine just duplicates network
4135 # traffic, so don't do that.
4236 preferLocalBuild = true;
pkgs/build-support/fetchadc/default.nix−10
@@ -1,15 +1,5 @@
11{ stdenv, curl, adc_user, adc_pass }:
22
3−let
4− impureEnvVars = [
5− # We borrow these environment variables from the caller to allow
6− # easy proxy configuration. This is impure, but a fixed-output
7− # derivation like fetchurl is allowed to do so since its result is
8− # by definition pure.
9− "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
10− ];
11−in
12−
133{ # Path to fetch.
144 path
155
pkgs/build-support/fetchegg/default.nix+1−7
@@ -17,12 +17,6 @@ stdenv.mkDerivation {
1717
1818 eggName = name;
1919
20− impureEnvVars = [
21− # We borrow these environment variables from the caller to allow
22− # easy proxy configuration. This is impure, but a fixed-output
23− # derivation like fetchurl is allowed to do so since its result is
24− # by definition pure.
25− "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
26− ];
20+ impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars;
2721}
2822
pkgs/build-support/fetchgit/default.nix+3−7
@@ -56,13 +56,9 @@ stdenv.mkDerivation {
5656
5757 GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
5858
59− impureEnvVars = [
60− # We borrow these environment variables from the caller to allow
61− # easy proxy configuration. This is impure, but a fixed-output
62− # derivation like fetchurl is allowed to do so since its result is
63− # by definition pure.
64− "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy" "GIT_PROXY_COMMAND" "SOCKS_SERVER"
65− ];
59+ impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars ++ [
60+ "GIT_PROXY_COMMAND" "SOCKS_SERVER"
61+ ];
6662
6763 preferLocalBuild = true;
6864}
pkgs/build-support/fetchhg/default.nix+1−3
@@ -6,9 +6,7 @@ stdenv.mkDerivation {
66 builder = ./builder.sh;
77 buildInputs = [mercurial];
88
9− impureEnvVars = [
10− "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
11− ];
9+ impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars;
1210
1311 # Nix <= 0.7 compatibility.
1412 id = md5;
pkgs/build-support/fetchmtn/default.nix+2−7
@@ -19,12 +19,7 @@ stdenv.mkDerivation {
1919 dbs = defaultDBMirrors ++ dbs;
2020 inherit branch cacheDB name selector;
2121
22− impureEnvVars = [
23− # We borrow these environment variables from the caller to allow
24− # easy proxy configuration. This is impure, but a fixed-output
25− # derivation like fetchurl is allowed to do so since its result is
26− # by definition pure.
27− "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
28− ];
22+ impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars;
23+
2924}
3025
pkgs/build-support/fetchsvn/default.nix+1−8
@@ -33,13 +33,6 @@ stdenv.mkDerivation {
3333
3434 inherit url rev sshSupport openssh ignoreExternals;
3535
36− impureEnvVars = [
37− # We borrow these environment variables from the caller to allow
38− # easy proxy configuration. This is impure, but a fixed-output
39− # derivation like fetchurl is allowed to do so since its result is
40− # by definition pure.
41− "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
42− ];
43−
36+ impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars;
4437 preferLocalBuild = true;
4538}
pkgs/build-support/fetchurl/default.nix+1−7
@@ -20,13 +20,7 @@ let
2020 # "gnu", etc.).
2121 sites = builtins.attrNames mirrors;
2222
23− impureEnvVars = [
24− # We borrow these environment variables from the caller to allow
25− # easy proxy configuration. This is impure, but a fixed-output
26− # derivation like fetchurl is allowed to do so since its result is
27− # by definition pure.
28− "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
29−
23+ impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars ++ [
3024 # This variable allows the user to pass additional options to curl
3125 "NIX_CURL_FLAGS"
3226
pkgs/build-support/rust/fetchcargo.nix+1−1
@@ -20,6 +20,6 @@ stdenv.mkDerivation {
2020 outputHashMode = "recursive";
2121 outputHash = sha256;
2222
23− impureEnvVars = [ "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy" ];
23+ impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars;
2424 preferLocalBuild = true;
2525}