summary refs log tree commit diff
path: root/nixos/modules/services/misc/nix-daemon.nix
diff options
context:
space:
mode:
authorAtemu <atemu.main@gmail.com>2022-08-08 17:45:51 +0200
committerAtemu <atemu.main@gmail.com>2022-10-18 21:42:31 +0200
commitef70bdd10f0f0e4af352e7b131e8e30a4ec4d84f (patch)
tree72ea15a7998a6d4cae0ab4c349337e2a2ce65d2f /nixos/modules/services/misc/nix-daemon.nix
parent104e8082de1b20f9d0e1f05b1028795ed0e0e4bc (diff)
downloadnixpkgs-ef70bdd10f0f0e4af352e7b131e8e30a4ec4d84f.tar
nixpkgs-ef70bdd10f0f0e4af352e7b131e8e30a4ec4d84f.tar.gz
nixpkgs-ef70bdd10f0f0e4af352e7b131e8e30a4ec4d84f.tar.bz2
nixpkgs-ef70bdd10f0f0e4af352e7b131e8e30a4ec4d84f.tar.lz
nixpkgs-ef70bdd10f0f0e4af352e7b131e8e30a4ec4d84f.tar.xz
nixpkgs-ef70bdd10f0f0e4af352e7b131e8e30a4ec4d84f.tar.zst
nixpkgs-ef70bdd10f0f0e4af352e7b131e8e30a4ec4d84f.zip
nixos/nix-daemon: make checkConfig fully disable nix.conf validation
A new option checkAllErrors is introduced which implements the old checkConfig
toggle behaviour

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Diffstat (limited to 'nixos/modules/services/misc/nix-daemon.nix')
-rw-r--r--nixos/modules/services/misc/nix-daemon.nix17
1 files changed, 12 insertions, 5 deletions
diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix
index ba3ea4c47ac..c90da8ab89f 100644
--- a/nixos/modules/services/misc/nix-daemon.nix
+++ b/nixos/modules/services/misc/nix-daemon.nix
@@ -59,7 +59,7 @@ let
         ${mkKeyValuePairs cfg.settings}
         ${cfg.extraOptions}
       '';
-      checkPhase =
+      checkPhase = lib.optionalString cfg.checkConfig (
         if pkgs.stdenv.hostPlatform != pkgs.stdenv.buildPlatform then ''
           echo "Ignoring validation for cross-compilation"
         ''
@@ -72,9 +72,9 @@ let
             ${cfg.package}/bin/nix show-config ${optionalString (isNixAtLeast "2.3pre") "--no-net"} \
               ${optionalString (isNixAtLeast "2.4pre") "--option experimental-features nix-command"} \
             |& sed -e 's/^warning:/error:/' \
-            | (! grep '${if cfg.checkConfig then "^error:" else "^error: unknown setting"}')
+            | (! grep '${if cfg.checkAllErrors then "^error:" else "^error: unknown setting"}')
           set -o pipefail
-        '';
+        '');
     };
 
   legacyConfMappings = {
@@ -395,8 +395,15 @@ in
         type = types.bool;
         default = true;
         description = lib.mdDoc ''
-          If enabled (the default), checks for data type mismatches and that Nix
-          can parse the generated nix.conf.
+          If enabled (the default), checks that Nix can parse the generated nix.conf.
+        '';
+      };
+
+      checkAllErrors = mkOption {
+        type = types.bool;
+        default = true;
+        description = lib.mdDoc ''
+          If enabled (the default), checks the nix.conf parsing for any kind of error. When disabled, checks only for unknown settings.
         '';
       };