Commit ef70bdd1 authored by Atemu's avatar Atemu
Browse files

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: default avatarSandro <sandro.jaeckel@gmail.com>
parent 104e8082
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -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.
        '';
      };