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