From ef70bdd10f0f0e4af352e7b131e8e30a4ec4d84f Mon Sep 17 00:00:00 2001 From: Atemu Date: Mon, 8 Aug 2022 17:45:51 +0200 Subject: [PATCH 1/2] 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 --- nixos/modules/services/misc/nix-daemon.nix | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix index ba3ea4c47ac1..c90da8ab89f1 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. ''; }; From bf6d84958df325e51eb0d64a4ace1dcbec6fa911 Mon Sep 17 00:00:00 2001 From: Atemu Date: Sat, 8 Oct 2022 14:28:43 +0200 Subject: [PATCH 2/2] rl-2211: document nix.checkConfig option changes Co-authored-by: Sandro --- .../doc/manual/from_md/release-notes/rl-2211.section.xml | 8 ++++++++ nixos/doc/manual/release-notes/rl-2211.section.md | 2 ++ nixos/modules/services/misc/nix-daemon.nix | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml index ec0afe73eb4a..8e26004cec4a 100644 --- a/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml +++ b/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml @@ -593,6 +593,14 @@ module removed, due to lack of maintainers. + + + The nix.checkConfig option now fully + disables the config check. The new + nix.checkAllErrors option behaves like + nix.checkConfig previously did. + + generateOptparseApplicativeCompletions and diff --git a/nixos/doc/manual/release-notes/rl-2211.section.md b/nixos/doc/manual/release-notes/rl-2211.section.md index 1028a975f30f..8bd31101f285 100644 --- a/nixos/doc/manual/release-notes/rl-2211.section.md +++ b/nixos/doc/manual/release-notes/rl-2211.section.md @@ -196,6 +196,8 @@ Available as [services.patroni](options.html#opt-services.patroni.enable). - virtlyst package and `services.virtlyst` module removed, due to lack of maintainers. +- The `nix.checkConfig` option now fully disables the config check. The new `nix.checkAllErrors` option behaves like `nix.checkConfig` previously did. + - `generateOptparseApplicativeCompletions` and `generateOptparseApplicativeCompletion` from `haskell.lib.compose` (and `haskell.lib`) have been deprecated in favor of `generateOptparseApplicativeCompletions` (plural!) as provided by the haskell package sets (so `haskellPackages.generateOptparseApplicativeCompletions` etc.). diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix index c90da8ab89f1..e8a21c352bdd 100644 --- a/nixos/modules/services/misc/nix-daemon.nix +++ b/nixos/modules/services/misc/nix-daemon.nix @@ -395,7 +395,7 @@ in type = types.bool; default = true; description = lib.mdDoc '' - If enabled (the default), checks that Nix can parse the generated nix.conf. + If enabled, checks that Nix can parse the generated nix.conf. ''; }; @@ -403,7 +403,7 @@ in 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. + If enabled, checks the nix.conf parsing for any kind of error. When disabled, checks only for unknown settings. ''; };