diff --git a/nixos/modules/config/nix.nix b/nixos/modules/config/nix.nix index e1c347242878..b59b0f3cd0f6 100644 --- a/nixos/modules/config/nix.nix +++ b/nixos/modules/config/nix.nix @@ -45,6 +45,19 @@ let isNixAtLeast = versionAtLeast (getVersion nixPackage); + defaultSystemFeatures = [ + "nixos-test" + "benchmark" + "big-parallel" + "kvm" + ] ++ optionals (pkgs.stdenv.hostPlatform ? gcc.arch) ( + # a builder can run code for `gcc.arch` and inferior architectures + [ "gccarch-${pkgs.stdenv.hostPlatform.gcc.arch}" ] + ++ map (x: "gccarch-${x}") ( + systems.architectures.inferiors.${pkgs.stdenv.hostPlatform.gcc.arch} or [ ] + ) + ); + legacyConfMappings = { useSandbox = "sandbox"; buildCores = "cores"; @@ -315,20 +328,9 @@ in system-features = mkOption { type = types.listOf types.str; - default = - [ - "nixos-test" - "benchmark" - "big-parallel" - "kvm" - ] - ++ optionals (pkgs.stdenv.hostPlatform ? gcc.arch) ( - # a builder can run code for `gcc.arch` and inferior architectures - [ "gccarch-${pkgs.stdenv.hostPlatform.gcc.arch}" ] - ++ map (x: "gccarch-${x}") ( - systems.architectures.inferiors.${pkgs.stdenv.hostPlatform.gcc.arch} or [ ] - ) - ); + # We expose system-featuers here and in config below. + # This allows users to access the default value via `options.nix.settings.system-features` + default = defaultSystemFeatures; defaultText = literalExpression ''[ "nixos-test" "benchmark" "big-parallel" "kvm" "gccarch-" ]''; description = '' The set of features supported by the machine. Derivations @@ -385,6 +387,7 @@ in trusted-public-keys = [ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" ]; trusted-users = [ "root" ]; substituters = mkAfter [ "https://cache.nixos.org/" ]; + system-features = defaultSystemFeatures; }; }; }