Skip to content

Commit 611bfa1

Browse files
authored
make nix.settings.system-features default mergeable again (NixOS#383052)
2 parents abd72d8 + 7b912bc commit 611bfa1

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

nixos/modules/config/nix.nix

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,19 @@ let
4545

4646
isNixAtLeast = versionAtLeast (getVersion nixPackage);
4747

48+
defaultSystemFeatures = [
49+
"nixos-test"
50+
"benchmark"
51+
"big-parallel"
52+
"kvm"
53+
] ++ optionals (pkgs.stdenv.hostPlatform ? gcc.arch) (
54+
# a builder can run code for `gcc.arch` and inferior architectures
55+
[ "gccarch-${pkgs.stdenv.hostPlatform.gcc.arch}" ]
56+
++ map (x: "gccarch-${x}") (
57+
systems.architectures.inferiors.${pkgs.stdenv.hostPlatform.gcc.arch} or [ ]
58+
)
59+
);
60+
4861
legacyConfMappings = {
4962
useSandbox = "sandbox";
5063
buildCores = "cores";
@@ -315,20 +328,9 @@ in
315328

316329
system-features = mkOption {
317330
type = types.listOf types.str;
318-
default =
319-
[
320-
"nixos-test"
321-
"benchmark"
322-
"big-parallel"
323-
"kvm"
324-
]
325-
++ optionals (pkgs.stdenv.hostPlatform ? gcc.arch) (
326-
# a builder can run code for `gcc.arch` and inferior architectures
327-
[ "gccarch-${pkgs.stdenv.hostPlatform.gcc.arch}" ]
328-
++ map (x: "gccarch-${x}") (
329-
systems.architectures.inferiors.${pkgs.stdenv.hostPlatform.gcc.arch} or [ ]
330-
)
331-
);
331+
# We expose system-featuers here and in config below.
332+
# This allows users to access the default value via `options.nix.settings.system-features`
333+
default = defaultSystemFeatures;
332334
defaultText = literalExpression ''[ "nixos-test" "benchmark" "big-parallel" "kvm" "gccarch-<arch>" ]'';
333335
description = ''
334336
The set of features supported by the machine. Derivations
@@ -385,6 +387,7 @@ in
385387
trusted-public-keys = [ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" ];
386388
trusted-users = [ "root" ];
387389
substituters = mkAfter [ "https://cache.nixos.org/" ];
390+
system-features = defaultSystemFeatures;
388391
};
389392
};
390393
}

0 commit comments

Comments
 (0)