From 0d89afdeddf3c6680a340857536a12e56e6d1606 Mon Sep 17 00:00:00 2001
From: Boris Sukholitko <boriss@gmail.com>
Date: Fri, 7 Nov 2014 13:46:36 +0200
Subject: [PATCH] docker: propagate nix.proxy into daemon environment

---
 nixos/modules/virtualisation/docker.nix | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/nixos/modules/virtualisation/docker.nix b/nixos/modules/virtualisation/docker.nix
index 1ce066cdc73..11d3f576728 100644
--- a/nixos/modules/virtualisation/docker.nix
+++ b/nixos/modules/virtualisation/docker.nix
@@ -7,6 +7,8 @@ with lib;
 let
 
   cfg = config.virtualisation.docker;
+  pro = config.nix.proxy;
+  proxy_env = optionalAttrs (pro != "") { Environment = "\"http_proxy=${pro}\""; };
 
 in
 
@@ -73,7 +75,7 @@ in
           #  goes in config bundled with docker itself
           LimitNOFILE = 1048576;
           LimitNPROC = 1048576;
-        };
+        } // proxy_env;
       };
 
       systemd.sockets.docker = {
@@ -99,7 +101,7 @@ in
           #  goes in config bundled with docker itself
           LimitNOFILE = 1048576;
           LimitNPROC = 1048576;
-        };
+        } // proxy_env;
 
         # Presumably some containers are running we don't want to interrupt
         restartIfChanged = false;