diff --git a/system/options.nix b/system/options.nix index 92d6288c597..c6f9e9a0e0f 100644 --- a/system/options.nix +++ b/system/options.nix @@ -2682,6 +2682,16 @@ in "; }; + proxy = mkOption { + default = ""; + description = " + This option specifies the proxy to use for fetchurl. The real effect + is just exporting http_proxy, https_proxy and ftp_proxy with that + value. + "; + example = "http://127.0.0.1:3128"; + }; + }; diff --git a/system/system.nix b/system/system.nix index 948b9a6a345..3cbbc8ddfee 100644 --- a/system/system.nix +++ b/system/system.nix @@ -103,7 +103,15 @@ rec { export NIX_REMOTE_SYSTEMS=/etc/nix.machines export NIX_CURRENT_LOAD=/var/run/nix/current-load '' - else ""); + else "") + + + (if config.nix.proxy != "" then + '' + export http_proxy=${config.nix.proxy} + export https_proxy=${config.nix.proxy} + export ftp_proxy=${config.nix.proxy} + '' else "") + ; # The services (Upstart) configuration for the system.