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