1 # This file defines the structure of the `config` nixpkgs option.
3 # This file is tested in `pkgs/test/config.nix`.
6 # nix-build -A tests.config
20 mkMassRebuild = args: mkOption (builtins.removeAttrs args [ "feature" ] // {
21 type = args.type or (types.uniq types.bool);
22 default = args.default or false;
23 description = ((args.description or ''
24 Whether to ${args.feature} while building nixpkgs packages.
26 Changing the default may cause a mass rebuild.
34 # Hide built-in module system options from docs.
35 _module.args = mkOption {
40 type = types.listOf types.str;
47 warnUndeclaredOptions = mkOption {
48 description = "Whether to warn when `config` contains an unrecognized attribute.";
53 doCheckByDefault = mkMassRebuild {
54 feature = "run `checkPhase` by default";
57 strictDepsByDefault = mkMassRebuild {
58 feature = "set `strictDeps` to true by default";
61 structuredAttrsByDefault = mkMassRebuild {
62 feature = "set `__structuredAttrs` to true by default";
65 enableParallelBuildingByDefault = mkMassRebuild {
66 feature = "set `enableParallelBuilding` to true by default";
69 configurePlatformsByDefault = mkMassRebuild {
70 feature = "set `configurePlatforms` to `[\"build\" \"host\"]` by default";
73 contentAddressedByDefault = mkMassRebuild {
74 feature = "set `__contentAddressed` to true by default";
77 allowAliases = mkOption {
81 Whether to expose old attribute names for compatibility.
83 The recommended setting is to enable this, as it
84 improves backward compatibility, easing updates.
86 The only reason to disable aliases is for continuous
87 integration purposes. For instance, Nixpkgs should
88 not depend on aliases in its internal code. Projects
89 that aren't Nixpkgs should be cautious of instantly
90 removing all usages of aliases, as migrating too soon
91 can break compatibility with the stable Nixpkgs releases.
95 allowUnfree = mkOption {
98 # getEnv part is in check-meta.nix
99 defaultText = literalExpression ''false || builtins.getEnv "NIXPKGS_ALLOW_UNFREE" == "1"'';
101 Whether to allow unfree packages.
103 See [Installing unfree packages](https://nixos.org/manual/nixpkgs/stable/#sec-allow-unfree) in the NixOS manual.
107 allowBroken = mkOption {
110 # getEnv part is in check-meta.nix
111 defaultText = literalExpression ''false || builtins.getEnv "NIXPKGS_ALLOW_BROKEN" == "1"'';
113 Whether to allow broken packages.
115 See [Installing broken packages](https://nixos.org/manual/nixpkgs/stable/#sec-allow-broken) in the NixOS manual.
119 allowUnsupportedSystem = mkOption {
122 # getEnv part is in check-meta.nix
123 defaultText = literalExpression ''false || builtins.getEnv "NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM" == "1"'';
125 Whether to allow unsupported packages.
127 See [Installing packages on unsupported systems](https://nixos.org/manual/nixpkgs/stable/#sec-allow-unsupported-system) in the NixOS manual.
131 cudaSupport = mkMassRebuild {
134 feature = "build packages with CUDA support by default";
137 replaceBootstrapFiles = mkMassRebuild {
138 type = types.functionTo (types.attrsOf types.package);
140 defaultText = literalExpression "lib.id";
142 Use the bootstrap files returned instead of the default bootstrap
144 The default bootstrap files are passed as an argument.
146 example = literalExpression ''
150 "sha256-YQlr088HPoVWBU2jpPhpIMyOyoEDZYDw1y60SGGbUM0=" = import <nix/fetchurl.nix> {
151 url = "(custom glibc linux x86_64 bootstrap-tools.tar.xz)";
154 "sha256-QrTEnQTBM1Y/qV9odq8irZkQSD9uOMbs2Q5NgCvKCNQ=" = import <nix/fetchurl.nix> {
155 url = "(custom glibc linux x86_64 busybox)";
161 builtins.mapAttrs (name: prev: replacements.''${prev.outputHash} or prev) prevFiles
165 rocmSupport = mkMassRebuild {
168 feature = "build packages with ROCm support by default";
171 showDerivationWarnings = mkOption {
172 type = types.listOf (types.enum [ "maintainerless" ]);
175 Which warnings to display for potentially dangerous
176 or deprecated values passed into `stdenv.mkDerivation`.
178 A list of warnings can be found in
179 [/pkgs/stdenv/generic/check-meta.nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/check-meta.nix).
181 This is not a stable interface; warnings may be added, changed
182 or removed without prior notice.
186 checkMeta = mkOption {
190 Whether to check that the `meta` attribute of derivations are correct during evaluation time.
198 let t = types.lazyAttrsOf types.raw;
201 let r = t.merge loc defs;
202 in r // { _undeclared = r; };
208 warnings = optionals config.warnUndeclaredOptions (
209 mapAttrsToList (k: v: "undeclared Nixpkgs option set: config.${k}") config._undeclared or {}