1 # This file defines the structure of the `config` nixpkgs option.
9 mkMassRebuild = args: mkOption (builtins.removeAttrs args [ "feature" ] // {
10 type = args.type or (types.uniq types.bool);
11 default = args.default or false;
12 description = lib.mdDoc ((args.description or ''
13 Whether to ${args.feature} while building nixpkgs packages.
15 Changing the default may cause a mass rebuild.
23 # Hide built-in module system options from docs.
24 _module.args = mkOption {
29 type = types.listOf types.str;
36 warnUndeclaredOptions = mkOption {
37 description = lib.mdDoc "Whether to warn when `config` contains an unrecognized attribute.";
42 doCheckByDefault = mkMassRebuild {
43 feature = "run `checkPhase` by default";
46 strictDepsByDefault = mkMassRebuild {
47 feature = "set `strictDeps` to true by default";
50 structuredAttrsByDefault = mkMassRebuild {
51 feature = "set `__structuredAttrs` to true by default";
54 enableParallelBuildingByDefault = mkMassRebuild {
55 feature = "set `enableParallelBuilding` to true by default";
58 configurePlatformsByDefault = mkMassRebuild {
59 feature = "set `configurePlatforms` to `[\"build\" \"host\"]` by default";
62 contentAddressedByDefault = mkMassRebuild {
63 feature = "set `__contentAddressed` to true by default";
66 allowAliases = mkOption {
69 description = lib.mdDoc ''
70 Whether to expose old attribute names for compatibility.
72 The recommended setting is to enable this, as it
73 improves backward compatibity, easing updates.
75 The only reason to disable aliases is for continuous
76 integration purposes. For instance, Nixpkgs should
77 not depend on aliases in its internal code. Projects
78 that aren't Nixpkgs should be cautious of instantly
79 removing all usages of aliases, as migrating too soon
80 can break compatibility with the stable Nixpkgs releases.
84 allowUnfree = mkOption {
87 # getEnv part is in check-meta.nix
88 defaultText = literalExpression ''false || builtins.getEnv "NIXPKGS_ALLOW_UNFREE" == "1"'';
89 description = lib.mdDoc ''
90 Whether to allow unfree packages.
92 See [Installing unfree packages](https://nixos.org/manual/nixpkgs/stable/#sec-allow-unfree) in the NixOS manual.
96 allowBroken = mkOption {
99 # getEnv part is in check-meta.nix
100 defaultText = literalExpression ''false || builtins.getEnv "NIXPKGS_ALLOW_BROKEN" == "1"'';
101 description = lib.mdDoc ''
102 Whether to allow broken packages.
104 See [Installing broken packages](https://nixos.org/manual/nixpkgs/stable/#sec-allow-broken) in the NixOS manual.
108 allowUnsupportedSystem = mkOption {
111 # getEnv part is in check-meta.nix
112 defaultText = literalExpression ''false || builtins.getEnv "NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM" == "1"'';
113 description = lib.mdDoc ''
114 Whether to allow unsupported packages.
116 See [Installing packages on unsupported systems](https://nixos.org/manual/nixpkgs/stable/#sec-allow-unsupported-system) in the NixOS manual.
120 cudaSupport = mkMassRebuild {
123 feature = "build packages with CUDA support by default";
126 rocmSupport = mkMassRebuild {
129 feature = "build packages with ROCm support by default";
132 showDerivationWarnings = mkOption {
133 type = types.listOf (types.enum [ "maintainerless" ]);
135 description = lib.mdDoc ''
136 Which warnings to display for potentially dangerous
137 or deprecated values passed into `stdenv.mkDerivation`.
139 A list of warnings can be found in
140 [/pkgs/stdenv/generic/check-meta.nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/check-meta.nix).
142 This is not a stable interface; warnings may be added, changed
143 or removed without prior notice.
147 checkMeta = mkOption {
150 description = lib.mdDoc ''
151 Whether to check that the `meta` attribute of derivations are correct during evaluation time.
159 let t = lib.types.lazyAttrsOf lib.types.raw;
162 let r = t.merge loc defs;
163 in r // { _undeclared = r; };
169 warnings = lib.optionals config.warnUndeclaredOptions (
170 lib.mapAttrsToList (k: v: "undeclared Nixpkgs option set: config.${k}") config._undeclared or {}