mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-17 06:06:13 +03:00
Avoid with lib;
at the top level in pkgs/top-level/config.nix
This commit is contained in:
parent
fec9460e07
commit
8a034c526e
@ -2,14 +2,20 @@
|
|||||||
|
|
||||||
{ config, lib, ... }:
|
{ config, lib, ... }:
|
||||||
|
|
||||||
with lib;
|
|
||||||
|
|
||||||
let
|
let
|
||||||
|
inherit (lib)
|
||||||
|
literalExpression
|
||||||
|
mapAttrsToList
|
||||||
|
mdDoc
|
||||||
|
mkOption
|
||||||
|
optionals
|
||||||
|
types
|
||||||
|
;
|
||||||
|
|
||||||
mkMassRebuild = args: mkOption (builtins.removeAttrs args [ "feature" ] // {
|
mkMassRebuild = args: mkOption (builtins.removeAttrs args [ "feature" ] // {
|
||||||
type = args.type or (types.uniq types.bool);
|
type = args.type or (types.uniq types.bool);
|
||||||
default = args.default or false;
|
default = args.default or false;
|
||||||
description = lib.mdDoc ((args.description or ''
|
description = mdDoc ((args.description or ''
|
||||||
Whether to ${args.feature} while building nixpkgs packages.
|
Whether to ${args.feature} while building nixpkgs packages.
|
||||||
'') + ''
|
'') + ''
|
||||||
Changing the default may cause a mass rebuild.
|
Changing the default may cause a mass rebuild.
|
||||||
@ -34,7 +40,7 @@ let
|
|||||||
/* Config options */
|
/* Config options */
|
||||||
|
|
||||||
warnUndeclaredOptions = mkOption {
|
warnUndeclaredOptions = mkOption {
|
||||||
description = lib.mdDoc "Whether to warn when `config` contains an unrecognized attribute.";
|
description = mdDoc "Whether to warn when `config` contains an unrecognized attribute.";
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
@ -66,7 +72,7 @@ let
|
|||||||
allowAliases = mkOption {
|
allowAliases = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = lib.mdDoc ''
|
description = mdDoc ''
|
||||||
Whether to expose old attribute names for compatibility.
|
Whether to expose old attribute names for compatibility.
|
||||||
|
|
||||||
The recommended setting is to enable this, as it
|
The recommended setting is to enable this, as it
|
||||||
@ -86,7 +92,7 @@ let
|
|||||||
default = false;
|
default = false;
|
||||||
# getEnv part is in check-meta.nix
|
# getEnv part is in check-meta.nix
|
||||||
defaultText = literalExpression ''false || builtins.getEnv "NIXPKGS_ALLOW_UNFREE" == "1"'';
|
defaultText = literalExpression ''false || builtins.getEnv "NIXPKGS_ALLOW_UNFREE" == "1"'';
|
||||||
description = lib.mdDoc ''
|
description = mdDoc ''
|
||||||
Whether to allow unfree packages.
|
Whether to allow unfree packages.
|
||||||
|
|
||||||
See [Installing unfree packages](https://nixos.org/manual/nixpkgs/stable/#sec-allow-unfree) in the NixOS manual.
|
See [Installing unfree packages](https://nixos.org/manual/nixpkgs/stable/#sec-allow-unfree) in the NixOS manual.
|
||||||
@ -98,7 +104,7 @@ let
|
|||||||
default = false;
|
default = false;
|
||||||
# getEnv part is in check-meta.nix
|
# getEnv part is in check-meta.nix
|
||||||
defaultText = literalExpression ''false || builtins.getEnv "NIXPKGS_ALLOW_BROKEN" == "1"'';
|
defaultText = literalExpression ''false || builtins.getEnv "NIXPKGS_ALLOW_BROKEN" == "1"'';
|
||||||
description = lib.mdDoc ''
|
description = mdDoc ''
|
||||||
Whether to allow broken packages.
|
Whether to allow broken packages.
|
||||||
|
|
||||||
See [Installing broken packages](https://nixos.org/manual/nixpkgs/stable/#sec-allow-broken) in the NixOS manual.
|
See [Installing broken packages](https://nixos.org/manual/nixpkgs/stable/#sec-allow-broken) in the NixOS manual.
|
||||||
@ -110,7 +116,7 @@ let
|
|||||||
default = false;
|
default = false;
|
||||||
# getEnv part is in check-meta.nix
|
# getEnv part is in check-meta.nix
|
||||||
defaultText = literalExpression ''false || builtins.getEnv "NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM" == "1"'';
|
defaultText = literalExpression ''false || builtins.getEnv "NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM" == "1"'';
|
||||||
description = lib.mdDoc ''
|
description = mdDoc ''
|
||||||
Whether to allow unsupported packages.
|
Whether to allow unsupported packages.
|
||||||
|
|
||||||
See [Installing packages on unsupported systems](https://nixos.org/manual/nixpkgs/stable/#sec-allow-unsupported-system) in the NixOS manual.
|
See [Installing packages on unsupported systems](https://nixos.org/manual/nixpkgs/stable/#sec-allow-unsupported-system) in the NixOS manual.
|
||||||
@ -132,7 +138,7 @@ let
|
|||||||
showDerivationWarnings = mkOption {
|
showDerivationWarnings = mkOption {
|
||||||
type = types.listOf (types.enum [ "maintainerless" ]);
|
type = types.listOf (types.enum [ "maintainerless" ]);
|
||||||
default = [];
|
default = [];
|
||||||
description = lib.mdDoc ''
|
description = mdDoc ''
|
||||||
Which warnings to display for potentially dangerous
|
Which warnings to display for potentially dangerous
|
||||||
or deprecated values passed into `stdenv.mkDerivation`.
|
or deprecated values passed into `stdenv.mkDerivation`.
|
||||||
|
|
||||||
@ -147,7 +153,7 @@ let
|
|||||||
checkMeta = mkOption {
|
checkMeta = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = lib.mdDoc ''
|
description = mdDoc ''
|
||||||
Whether to check that the `meta` attribute of derivations are correct during evaluation time.
|
Whether to check that the `meta` attribute of derivations are correct during evaluation time.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
@ -156,7 +162,7 @@ let
|
|||||||
in {
|
in {
|
||||||
|
|
||||||
freeformType =
|
freeformType =
|
||||||
let t = lib.types.lazyAttrsOf lib.types.raw;
|
let t = types.lazyAttrsOf types.raw;
|
||||||
in t // {
|
in t // {
|
||||||
merge = loc: defs:
|
merge = loc: defs:
|
||||||
let r = t.merge loc defs;
|
let r = t.merge loc defs;
|
||||||
@ -166,8 +172,8 @@ in {
|
|||||||
inherit options;
|
inherit options;
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
warnings = lib.optionals config.warnUndeclaredOptions (
|
warnings = optionals config.warnUndeclaredOptions (
|
||||||
lib.mapAttrsToList (k: v: "undeclared Nixpkgs option set: config.${k}") config._undeclared or {}
|
mapAttrsToList (k: v: "undeclared Nixpkgs option set: config.${k}") config._undeclared or {}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user