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 enableParallelBuildingByDefault = mkMassRebuild {
51 feature = "set `enableParallelBuilding` to true by default";
54 configurePlatformsByDefault = mkMassRebuild {
55 feature = "set `configurePlatforms` to `[\"build\" \"host\"]` by default";
58 contentAddressedByDefault = mkMassRebuild {
59 feature = "set `__contentAddressed` to true by default";
62 allowAliases = mkOption {
65 description = lib.mdDoc ''
66 Whether to expose old attribute names for compatibility.
68 The recommended setting is to enable this, as it
69 improves backward compatibity, easing updates.
71 The only reason to disable aliases is for continuous
72 integration purposes. For instance, Nixpkgs should
73 not depend on aliases in its internal code. Projects
74 that aren't Nixpkgs should be cautious of instantly
75 removing all usages of aliases, as migrating too soon
76 can break compatibility with the stable Nixpkgs releases.
80 allowUnfree = mkOption {
83 # getEnv part is in check-meta.nix
84 defaultText = literalExpression ''false || builtins.getEnv "NIXPKGS_ALLOW_UNFREE" == "1"'';
85 description = lib.mdDoc ''
86 Whether to allow unfree packages.
88 See [Installing unfree packages](https://nixos.org/manual/nixpkgs/stable/#sec-allow-unfree) in the NixOS manual.
92 allowBroken = mkOption {
95 # getEnv part is in check-meta.nix
96 defaultText = literalExpression ''false || builtins.getEnv "NIXPKGS_ALLOW_BROKEN" == "1"'';
97 description = lib.mdDoc ''
98 Whether to allow broken packages.
100 See [Installing broken packages](https://nixos.org/manual/nixpkgs/stable/#sec-allow-broken) in the NixOS manual.
104 allowUnsupportedSystem = mkOption {
107 # getEnv part is in check-meta.nix
108 defaultText = literalExpression ''false || builtins.getEnv "NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM" == "1"'';
109 description = lib.mdDoc ''
110 Whether to allow unsupported packages.
112 See [Installing packages on unsupported systems](https://nixos.org/manual/nixpkgs/stable/#sec-allow-unsupported-system) in the NixOS manual.
116 showDerivationWarnings = mkOption {
117 type = types.listOf (types.enum [ "maintainerless" ]);
119 description = lib.mdDoc ''
120 Which warnings to display for potentially dangerous
121 or deprecated values passed into `stdenv.mkDerivation`.
123 A list of warnings can be found in
124 [/pkgs/stdenv/generic/check-meta.nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/check-meta.nix).
126 This is not a stable interface; warnings may be added, changed
127 or removed without prior notice.
131 checkMeta = mkOption {
135 Whether to check that the `meta` attribute of derivations are correct during evaluation time.
143 let t = lib.types.lazyAttrsOf lib.types.raw;
146 let r = t.merge loc defs;
147 in r // { _undeclared = r; };
153 warnings = lib.optionals config.warnUndeclaredOptions (
154 lib.mapAttrsToList (k: v: "undeclared Nixpkgs option set: config.${k}") config._undeclared or {}