summary refs log tree commit diff
path: root/nixos/modules/services/misc/nix-daemon.nix
diff options
context:
space:
mode:
authorSilvan Mosberger <infinisil@icloud.com>2019-09-28 16:49:53 +0200
committerSilvan Mosberger <infinisil@icloud.com>2019-09-28 17:00:47 +0200
commite463c7cd75f68e112b838252963ca20495903210 (patch)
tree71ed9d5b4c7e45bf429a2f48bd0b3b277a090b6a /nixos/modules/services/misc/nix-daemon.nix
parent07ca91187c5fd973c97cc1e40c526977f738e3c6 (diff)
downloadnixpkgs-e463c7cd75f68e112b838252963ca20495903210.tar
nixpkgs-e463c7cd75f68e112b838252963ca20495903210.tar.gz
nixpkgs-e463c7cd75f68e112b838252963ca20495903210.tar.bz2
nixpkgs-e463c7cd75f68e112b838252963ca20495903210.tar.lz
nixpkgs-e463c7cd75f68e112b838252963ca20495903210.tar.xz
nixpkgs-e463c7cd75f68e112b838252963ca20495903210.tar.zst
nixpkgs-e463c7cd75f68e112b838252963ca20495903210.zip
nixos/nix-daemon: Prevent network warning when checking config
Since version 2.3 (https://github.com/NixOS/nix/pull/2949 which was
cherry-picked to master) Nix issues a warning when --no-net wasn't
passed and there is no network interface. This commit adds the --no-net
flag to the nix.conf check such that no warning is issued.
Diffstat (limited to 'nixos/modules/services/misc/nix-daemon.nix')
-rw-r--r--nixos/modules/services/misc/nix-daemon.nix5
1 files changed, 3 insertions, 2 deletions
diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix
index 3826f728afd..3263f695423 100644
--- a/nixos/modules/services/misc/nix-daemon.nix
+++ b/nixos/modules/services/misc/nix-daemon.nix
@@ -11,6 +11,7 @@ let
   nixVersion = getVersion nix;
 
   isNix20 = versionAtLeast nixVersion "2.0pre";
+  isNix23 = versionAtLeast nixVersion "2.3pre";
 
   makeNixBuildUser = nr:
     { name = "nixbld${toString nr}";
@@ -63,7 +64,7 @@ let
           builders =
         ''}
         system-features = ${toString cfg.systemFeatures}
-        ${optionalString (versionAtLeast nixVersion "2.3pre") ''
+        ${optionalString isNix23 ''
           sandbox-fallback = false
         ''}
         $extraOptions
@@ -74,7 +75,7 @@ let
             '' else ''
               echo "Checking that Nix can read nix.conf..."
               ln -s $out ./nix.conf
-              NIX_CONF_DIR=$PWD ${cfg.package}/bin/nix show-config >/dev/null
+              NIX_CONF_DIR=$PWD ${cfg.package}/bin/nix show-config ${optionalString isNix23 "--no-net"} >/dev/null
             '')
       );