2019-02-23 00:00:01 +00:00
|
|
|
# This file defines the structure of the `config` nixpkgs option.
|
|
|
|
|
2024-04-24 10:49:33 +00:00
|
|
|
# This file is tested in `pkgs/test/config.nix`.
|
|
|
|
# Run tests with:
|
|
|
|
#
|
|
|
|
# nix-build -A tests.config
|
|
|
|
#
|
|
|
|
|
2022-04-30 10:57:50 +00:00
|
|
|
{ config, lib, ... }:
|
2019-02-23 00:00:01 +00:00
|
|
|
|
|
|
|
let
|
2024-03-06 01:42:18 +00:00
|
|
|
inherit (lib)
|
|
|
|
literalExpression
|
|
|
|
mapAttrsToList
|
|
|
|
mkOption
|
|
|
|
optionals
|
|
|
|
types
|
|
|
|
;
|
2019-02-23 00:00:01 +00:00
|
|
|
|
|
|
|
mkMassRebuild = args: mkOption (builtins.removeAttrs args [ "feature" ] // {
|
|
|
|
type = args.type or (types.uniq types.bool);
|
|
|
|
default = args.default or false;
|
2024-04-13 13:00:20 +00:00
|
|
|
description = ((args.description or ''
|
2019-02-23 00:00:01 +00:00
|
|
|
Whether to ${args.feature} while building nixpkgs packages.
|
|
|
|
'') + ''
|
2019-03-08 09:23:30 +00:00
|
|
|
Changing the default may cause a mass rebuild.
|
2022-09-11 14:19:44 +00:00
|
|
|
'');
|
2019-02-23 00:00:01 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
/* Internal stuff */
|
|
|
|
|
2022-05-01 19:43:10 +00:00
|
|
|
# Hide built-in module system options from docs.
|
|
|
|
_module.args = mkOption {
|
|
|
|
internal = true;
|
|
|
|
};
|
|
|
|
|
2019-02-23 00:00:01 +00:00
|
|
|
warnings = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [];
|
|
|
|
internal = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Config options */
|
|
|
|
|
2022-04-30 10:57:50 +00:00
|
|
|
warnUndeclaredOptions = mkOption {
|
2024-04-13 13:00:20 +00:00
|
|
|
description = "Whether to warn when `config` contains an unrecognized attribute.";
|
2022-09-11 07:34:37 +00:00
|
|
|
type = types.bool;
|
2022-04-30 10:57:50 +00:00
|
|
|
default = false;
|
|
|
|
};
|
|
|
|
|
2019-02-23 00:00:01 +00:00
|
|
|
doCheckByDefault = mkMassRebuild {
|
2022-09-11 14:19:44 +00:00
|
|
|
feature = "run `checkPhase` by default";
|
2019-02-23 00:00:01 +00:00
|
|
|
};
|
|
|
|
|
2022-04-27 14:53:08 +00:00
|
|
|
strictDepsByDefault = mkMassRebuild {
|
2022-09-11 14:19:44 +00:00
|
|
|
feature = "set `strictDeps` to true by default";
|
2022-04-27 14:53:08 +00:00
|
|
|
};
|
|
|
|
|
2022-11-17 16:30:58 +00:00
|
|
|
structuredAttrsByDefault = mkMassRebuild {
|
|
|
|
feature = "set `__structuredAttrs` to true by default";
|
|
|
|
};
|
|
|
|
|
2022-05-11 13:41:30 +00:00
|
|
|
enableParallelBuildingByDefault = mkMassRebuild {
|
2022-09-11 14:19:44 +00:00
|
|
|
feature = "set `enableParallelBuilding` to true by default";
|
2022-05-11 13:41:30 +00:00
|
|
|
};
|
|
|
|
|
2022-06-21 07:14:34 +00:00
|
|
|
configurePlatformsByDefault = mkMassRebuild {
|
2022-09-11 14:19:44 +00:00
|
|
|
feature = "set `configurePlatforms` to `[\"build\" \"host\"]` by default";
|
2022-06-21 07:14:34 +00:00
|
|
|
};
|
|
|
|
|
2022-04-27 20:21:32 +00:00
|
|
|
contentAddressedByDefault = mkMassRebuild {
|
2022-09-11 14:19:44 +00:00
|
|
|
feature = "set `__contentAddressed` to true by default";
|
2022-04-27 20:21:32 +00:00
|
|
|
};
|
|
|
|
|
2022-04-01 09:33:10 +00:00
|
|
|
allowAliases = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
2024-04-13 13:00:20 +00:00
|
|
|
description = ''
|
2022-04-01 09:33:10 +00:00
|
|
|
Whether to expose old attribute names for compatibility.
|
|
|
|
|
|
|
|
The recommended setting is to enable this, as it
|
2024-04-02 21:47:24 +00:00
|
|
|
improves backward compatibility, easing updates.
|
2022-04-01 09:33:10 +00:00
|
|
|
|
|
|
|
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 12:49:04 +00:00
|
|
|
allowUnfree = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
# getEnv part is in check-meta.nix
|
|
|
|
defaultText = literalExpression ''false || builtins.getEnv "NIXPKGS_ALLOW_UNFREE" == "1"'';
|
2024-04-13 13:00:20 +00:00
|
|
|
description = ''
|
2022-05-02 12:49:04 +00:00
|
|
|
Whether to allow unfree packages.
|
|
|
|
|
2022-09-11 14:19:44 +00:00
|
|
|
See [Installing unfree packages](https://nixos.org/manual/nixpkgs/stable/#sec-allow-unfree) in the NixOS manual.
|
2022-05-02 12:49:04 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2022-05-02 14:20:44 +00:00
|
|
|
allowBroken = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
# getEnv part is in check-meta.nix
|
|
|
|
defaultText = literalExpression ''false || builtins.getEnv "NIXPKGS_ALLOW_BROKEN" == "1"'';
|
2024-04-13 13:00:20 +00:00
|
|
|
description = ''
|
2022-05-02 14:20:44 +00:00
|
|
|
Whether to allow broken packages.
|
|
|
|
|
2022-09-11 14:19:44 +00:00
|
|
|
See [Installing broken packages](https://nixos.org/manual/nixpkgs/stable/#sec-allow-broken) in the NixOS manual.
|
2022-05-02 14:20:44 +00:00
|
|
|
'';
|
|
|
|
};
|
2022-05-02 17:39:43 +00: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"'';
|
2024-04-13 13:00:20 +00:00
|
|
|
description = ''
|
2022-05-02 17:39:43 +00:00
|
|
|
Whether to allow unsupported packages.
|
|
|
|
|
2022-09-11 14:19:44 +00:00
|
|
|
See [Installing packages on unsupported systems](https://nixos.org/manual/nixpkgs/stable/#sec-allow-unsupported-system) in the NixOS manual.
|
2022-05-02 17:39:43 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-07-20 14:57:06 +00:00
|
|
|
cudaSupport = mkMassRebuild {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
feature = "build packages with CUDA support by default";
|
|
|
|
};
|
|
|
|
|
2023-11-14 00:50:59 +00:00
|
|
|
rocmSupport = mkMassRebuild {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
feature = "build packages with ROCm support by default";
|
|
|
|
};
|
|
|
|
|
2022-05-03 19:16:04 +00:00
|
|
|
showDerivationWarnings = mkOption {
|
|
|
|
type = types.listOf (types.enum [ "maintainerless" ]);
|
|
|
|
default = [];
|
2024-04-13 13:00:20 +00:00
|
|
|
description = ''
|
2022-05-03 19:16:04 +00: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 14:19:44 +00:00
|
|
|
[/pkgs/stdenv/generic/check-meta.nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/check-meta.nix).
|
2022-05-03 19:16:04 +00:00
|
|
|
|
|
|
|
This is not a stable interface; warnings may be added, changed
|
|
|
|
or removed without prior notice.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2022-09-14 10:17:39 +00:00
|
|
|
checkMeta = mkOption {
|
|
|
|
type = types.bool;
|
2022-10-02 12:28:40 +00:00
|
|
|
default = false;
|
2024-04-13 13:00:20 +00:00
|
|
|
description = ''
|
2022-09-14 10:17:39 +00:00
|
|
|
Whether to check that the `meta` attribute of derivations are correct during evaluation time.
|
|
|
|
'';
|
|
|
|
};
|
2019-02-23 00:00:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
in {
|
|
|
|
|
2022-04-30 10:57:50 +00:00
|
|
|
freeformType =
|
2024-03-06 01:42:18 +00:00
|
|
|
let t = types.lazyAttrsOf types.raw;
|
2022-04-30 10:57:50 +00:00
|
|
|
in t // {
|
|
|
|
merge = loc: defs:
|
2022-05-10 04:53:43 +00:00
|
|
|
let r = t.merge loc defs;
|
|
|
|
in r // { _undeclared = r; };
|
2022-04-30 10:57:50 +00:00
|
|
|
};
|
|
|
|
|
2019-02-23 00:00:01 +00:00
|
|
|
inherit options;
|
|
|
|
|
2022-05-10 04:53:43 +00:00
|
|
|
config = {
|
2024-03-06 01:42:18 +00:00
|
|
|
warnings = optionals config.warnUndeclaredOptions (
|
|
|
|
mapAttrsToList (k: v: "undeclared Nixpkgs option set: config.${k}") config._undeclared or {}
|
2022-05-10 04:53:43 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2019-02-23 00:00:01 +00:00
|
|
|
}
|