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
|
|
|
|
2024-08-05 16:44:45 +00:00
|
|
|
mkMassRebuild = args: mkOption (builtins.removeAttrs args [ "feature" ] // {
|
|
|
|
type = args.type or (types.uniq types.bool);
|
|
|
|
default = args.default or false;
|
|
|
|
description = ((args.description or ''
|
|
|
|
Whether to ${args.feature} while building nixpkgs packages.
|
|
|
|
'') + ''
|
|
|
|
Changing the default may cause a mass rebuild.
|
|
|
|
'');
|
|
|
|
});
|
2019-02-23 00:00:01 +00:00
|
|
|
|
|
|
|
options = {
|
|
|
|
|
2024-08-05 16:44:45 +00:00
|
|
|
/* Internal stuff */
|
2019-02-23 00:00:01 +00:00
|
|
|
|
2022-05-01 19:43:10 +00:00
|
|
|
# Hide built-in module system options from docs.
|
2024-08-05 16:44:45 +00:00
|
|
|
_module.args = mkOption {
|
|
|
|
internal = true;
|
|
|
|
};
|
2022-05-01 19:43:10 +00:00
|
|
|
|
2019-02-23 00:00:01 +00:00
|
|
|
warnings = mkOption {
|
|
|
|
type = types.listOf types.str;
|
2024-08-05 16:44:45 +00:00
|
|
|
default = [];
|
2019-02-23 00:00:01 +00:00
|
|
|
internal = true;
|
|
|
|
};
|
|
|
|
|
2024-08-05 16:44:45 +00:00
|
|
|
/* Config options */
|
2019-02-23 00:00:01 +00:00
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2024-08-05 16:44:45 +00:00
|
|
|
doCheckByDefault = mkMassRebuild {
|
|
|
|
feature = "run `checkPhase` by default";
|
|
|
|
};
|
2019-02-23 00:00:01 +00:00
|
|
|
|
2024-08-05 16:44:45 +00:00
|
|
|
strictDepsByDefault = mkMassRebuild {
|
|
|
|
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";
|
|
|
|
};
|
|
|
|
|
2024-06-05 04:19:38 +00:00
|
|
|
replaceBootstrapFiles = mkMassRebuild {
|
|
|
|
type = types.functionTo (types.attrsOf types.package);
|
|
|
|
default = lib.id;
|
|
|
|
defaultText = literalExpression "lib.id";
|
|
|
|
description = ''
|
|
|
|
Use the bootstrap files returned instead of the default bootstrap
|
|
|
|
files.
|
|
|
|
The default bootstrap files are passed as an argument.
|
|
|
|
'';
|
|
|
|
example = literalExpression ''
|
|
|
|
prevFiles:
|
|
|
|
let
|
|
|
|
replacements = {
|
|
|
|
"sha256-YQlr088HPoVWBU2jpPhpIMyOyoEDZYDw1y60SGGbUM0=" = import <nix/fetchurl.nix> {
|
|
|
|
url = "(custom glibc linux x86_64 bootstrap-tools.tar.xz)";
|
|
|
|
hash = "(...)";
|
|
|
|
};
|
|
|
|
"sha256-QrTEnQTBM1Y/qV9odq8irZkQSD9uOMbs2Q5NgCvKCNQ=" = import <nix/fetchurl.nix> {
|
|
|
|
url = "(custom glibc linux x86_64 busybox)";
|
|
|
|
hash = "(...)";
|
|
|
|
executable = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
builtins.mapAttrs (name: prev: replacements.''${prev.outputHash} or prev) prevFiles
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
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" ]);
|
2024-08-05 16:44:45 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
|
2024-08-05 16:44:45 +00:00
|
|
|
in {
|
2019-02-23 00:00:01 +00:00
|
|
|
|
2022-04-30 10:57:50 +00:00
|
|
|
freeformType =
|
2024-08-05 16:44:45 +00:00
|
|
|
let t = types.lazyAttrsOf types.raw;
|
|
|
|
in t // {
|
|
|
|
merge = loc: defs:
|
|
|
|
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 (
|
2024-08-05 16:44:45 +00:00
|
|
|
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
|
|
|
}
|