2019-02-23 03:00:01 +03:00
|
|
|
# This file defines the structure of the `config` nixpkgs option.
|
|
|
|
|
2022-04-30 13:57:50 +03:00
|
|
|
{ config, lib, ... }:
|
2019-02-23 03:00:01 +03:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
mkMassRebuild = args: mkOption (builtins.removeAttrs args [ "feature" ] // {
|
|
|
|
type = args.type or (types.uniq types.bool);
|
|
|
|
default = args.default or false;
|
2022-09-11 17:19:44 +03:00
|
|
|
description = lib.mdDoc ((args.description or ''
|
2019-02-23 03:00:01 +03:00
|
|
|
Whether to ${args.feature} while building nixpkgs packages.
|
|
|
|
'') + ''
|
2019-03-08 12:23:30 +03:00
|
|
|
Changing the default may cause a mass rebuild.
|
2022-09-11 17:19:44 +03:00
|
|
|
'');
|
2019-02-23 03:00:01 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
/* Internal stuff */
|
|
|
|
|
2022-05-01 22:43:10 +03:00
|
|
|
# Hide built-in module system options from docs.
|
|
|
|
_module.args = mkOption {
|
|
|
|
internal = true;
|
|
|
|
};
|
|
|
|
|
2019-02-23 03:00:01 +03:00
|
|
|
warnings = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [];
|
|
|
|
internal = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Config options */
|
|
|
|
|
2022-04-30 13:57:50 +03:00
|
|
|
warnUndeclaredOptions = mkOption {
|
2022-09-11 17:19:44 +03:00
|
|
|
description = lib.mdDoc "Whether to warn when `config` contains an unrecognized attribute.";
|
2022-09-11 10:34:37 +03:00
|
|
|
type = types.bool;
|
2022-04-30 13:57:50 +03:00
|
|
|
default = false;
|
|
|
|
};
|
|
|
|
|
2019-02-23 03:00:01 +03:00
|
|
|
doCheckByDefault = mkMassRebuild {
|
2022-09-11 17:19:44 +03:00
|
|
|
feature = "run `checkPhase` by default";
|
2019-02-23 03:00:01 +03:00
|
|
|
};
|
|
|
|
|
2022-04-27 17:53:08 +03:00
|
|
|
strictDepsByDefault = mkMassRebuild {
|
2022-09-11 17:19:44 +03:00
|
|
|
feature = "set `strictDeps` to true by default";
|
2022-04-27 17:53:08 +03:00
|
|
|
};
|
|
|
|
|
2022-11-17 19:30:58 +03:00
|
|
|
structuredAttrsByDefault = mkMassRebuild {
|
|
|
|
feature = "set `__structuredAttrs` to true by default";
|
|
|
|
};
|
|
|
|
|
2022-05-11 16:41:30 +03:00
|
|
|
enableParallelBuildingByDefault = mkMassRebuild {
|
2022-09-11 17:19:44 +03:00
|
|
|
feature = "set `enableParallelBuilding` to true by default";
|
2022-05-11 16:41:30 +03:00
|
|
|
};
|
|
|
|
|
2022-06-21 10:14:34 +03:00
|
|
|
configurePlatformsByDefault = mkMassRebuild {
|
2022-09-11 17:19:44 +03:00
|
|
|
feature = "set `configurePlatforms` to `[\"build\" \"host\"]` by default";
|
2022-06-21 10:14:34 +03:00
|
|
|
};
|
|
|
|
|
2022-04-27 23:21:32 +03:00
|
|
|
contentAddressedByDefault = mkMassRebuild {
|
2022-09-11 17:19:44 +03:00
|
|
|
feature = "set `__contentAddressed` to true by default";
|
2022-04-27 23:21:32 +03:00
|
|
|
};
|
|
|
|
|
2022-04-01 12:33:10 +03:00
|
|
|
allowAliases = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
2022-09-11 17:19:44 +03:00
|
|
|
description = lib.mdDoc ''
|
2022-04-01 12:33:10 +03:00
|
|
|
Whether to expose old attribute names for compatibility.
|
|
|
|
|
|
|
|
The recommended setting is to enable this, as it
|
|
|
|
improves backward compatibity, easing updates.
|
|
|
|
|
|
|
|
The only reason to disable aliases is for continuous
|
|
|
|
integration purposes. For instance, Nixpkgs should
|
|
|
|
not depend on aliases in its internal code. Projects
|
|
|
|
that aren't Nixpkgs should be cautious of instantly
|
|
|
|
removing all usages of aliases, as migrating too soon
|
|
|
|
can break compatibility with the stable Nixpkgs releases.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2022-05-02 15:49:04 +03:00
|
|
|
allowUnfree = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
# getEnv part is in check-meta.nix
|
|
|
|
defaultText = literalExpression ''false || builtins.getEnv "NIXPKGS_ALLOW_UNFREE" == "1"'';
|
2022-09-11 17:19:44 +03:00
|
|
|
description = lib.mdDoc ''
|
2022-05-02 15:49:04 +03:00
|
|
|
Whether to allow unfree packages.
|
|
|
|
|
2022-09-11 17:19:44 +03:00
|
|
|
See [Installing unfree packages](https://nixos.org/manual/nixpkgs/stable/#sec-allow-unfree) in the NixOS manual.
|
2022-05-02 15:49:04 +03:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2022-05-02 17:20:44 +03:00
|
|
|
allowBroken = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
# getEnv part is in check-meta.nix
|
|
|
|
defaultText = literalExpression ''false || builtins.getEnv "NIXPKGS_ALLOW_BROKEN" == "1"'';
|
2022-09-11 17:19:44 +03:00
|
|
|
description = lib.mdDoc ''
|
2022-05-02 17:20:44 +03:00
|
|
|
Whether to allow broken packages.
|
|
|
|
|
2022-09-11 17:19:44 +03:00
|
|
|
See [Installing broken packages](https://nixos.org/manual/nixpkgs/stable/#sec-allow-broken) in the NixOS manual.
|
2022-05-02 17:20:44 +03:00
|
|
|
'';
|
|
|
|
};
|
2022-05-02 20:39:43 +03:00
|
|
|
|
|
|
|
allowUnsupportedSystem = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
# getEnv part is in check-meta.nix
|
|
|
|
defaultText = literalExpression ''false || builtins.getEnv "NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM" == "1"'';
|
2022-09-11 17:19:44 +03:00
|
|
|
description = lib.mdDoc ''
|
2022-05-02 20:39:43 +03:00
|
|
|
Whether to allow unsupported packages.
|
|
|
|
|
2022-09-11 17:19:44 +03:00
|
|
|
See [Installing packages on unsupported systems](https://nixos.org/manual/nixpkgs/stable/#sec-allow-unsupported-system) in the NixOS manual.
|
2022-05-02 20:39:43 +03:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2022-05-03 22:16:04 +03:00
|
|
|
showDerivationWarnings = mkOption {
|
|
|
|
type = types.listOf (types.enum [ "maintainerless" ]);
|
|
|
|
default = [];
|
2022-09-11 17:19:44 +03:00
|
|
|
description = lib.mdDoc ''
|
2022-05-03 22:16:04 +03:00
|
|
|
Which warnings to display for potentially dangerous
|
|
|
|
or deprecated values passed into `stdenv.mkDerivation`.
|
|
|
|
|
|
|
|
A list of warnings can be found in
|
2022-09-11 17:19:44 +03:00
|
|
|
[/pkgs/stdenv/generic/check-meta.nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/check-meta.nix).
|
2022-05-03 22:16:04 +03:00
|
|
|
|
|
|
|
This is not a stable interface; warnings may be added, changed
|
|
|
|
or removed without prior notice.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2022-09-14 13:17:39 +03:00
|
|
|
checkMeta = mkOption {
|
|
|
|
type = types.bool;
|
2022-10-02 15:28:40 +03:00
|
|
|
default = false;
|
2023-06-10 18:57:37 +03:00
|
|
|
description = lib.mdDoc ''
|
2022-09-14 13:17:39 +03:00
|
|
|
Whether to check that the `meta` attribute of derivations are correct during evaluation time.
|
|
|
|
'';
|
|
|
|
};
|
2019-02-23 03:00:01 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
in {
|
|
|
|
|
2022-04-30 13:57:50 +03:00
|
|
|
freeformType =
|
2022-05-29 11:24:20 +03:00
|
|
|
let t = lib.types.lazyAttrsOf lib.types.raw;
|
2022-04-30 13:57:50 +03:00
|
|
|
in t // {
|
|
|
|
merge = loc: defs:
|
2022-05-10 07:53:43 +03:00
|
|
|
let r = t.merge loc defs;
|
|
|
|
in r // { _undeclared = r; };
|
2022-04-30 13:57:50 +03:00
|
|
|
};
|
|
|
|
|
2019-02-23 03:00:01 +03:00
|
|
|
inherit options;
|
|
|
|
|
2022-05-10 07:53:43 +03:00
|
|
|
config = {
|
|
|
|
warnings = lib.optionals config.warnUndeclaredOptions (
|
2022-06-06 00:50:52 +03:00
|
|
|
lib.mapAttrsToList (k: v: "undeclared Nixpkgs option set: config.${k}") config._undeclared or {}
|
2022-05-10 07:53:43 +03:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2019-02-23 03:00:01 +03:00
|
|
|
}
|