about summary refs log tree commit diff
path: root/pkgs/top-level
diff options
context:
space:
mode:
authorPhilip Taron <philip.taron@gmail.com>2024-03-05 17:42:18 -0800
committerPhilip Taron <philip.taron@gmail.com>2024-03-08 14:55:07 -0800
commit8a034c526ef48e395727c825041fe328e98416f8 (patch)
tree60cc2fe5ba964d6e5bc9e1d3a3f2921c5209c9a6 /pkgs/top-level
parentfec9460e07d797a6d77e6aaf89d5ee4bc8545299 (diff)
downloadnixlib-8a034c526ef48e395727c825041fe328e98416f8.tar
nixlib-8a034c526ef48e395727c825041fe328e98416f8.tar.gz
nixlib-8a034c526ef48e395727c825041fe328e98416f8.tar.bz2
nixlib-8a034c526ef48e395727c825041fe328e98416f8.tar.lz
nixlib-8a034c526ef48e395727c825041fe328e98416f8.tar.xz
nixlib-8a034c526ef48e395727c825041fe328e98416f8.tar.zst
nixlib-8a034c526ef48e395727c825041fe328e98416f8.zip
Avoid `with lib;` at the top level in pkgs/top-level/config.nix
Diffstat (limited to 'pkgs/top-level')
-rw-r--r--pkgs/top-level/config.nix32
1 files changed, 19 insertions, 13 deletions
diff --git a/pkgs/top-level/config.nix b/pkgs/top-level/config.nix
index aa3a235553ef..3418a44e0f13 100644
--- a/pkgs/top-level/config.nix
+++ b/pkgs/top-level/config.nix
@@ -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 {}
     );
   };