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