about summary refs log tree commit diff
path: root/lib/modules.nix
diff options
context:
space:
mode:
authorRobert Hensing <roberth@users.noreply.github.com>2020-10-26 06:59:17 +0100
committerGitHub <noreply@github.com>2020-10-26 06:59:17 +0100
commit7102388834f1cd81c4d4bc48f41f0d4b8fa8933a (patch)
tree5f756199db6db3ec9056b488ae90c9cd242a4333 /lib/modules.nix
parentdfaa313d437d8de52e0e174570ecc95eed87bab2 (diff)
parenta4019a40b310912a5ba91c15cf5aa4a6a4a9376f (diff)
downloadnixlib-7102388834f1cd81c4d4bc48f41f0d4b8fa8933a.tar
nixlib-7102388834f1cd81c4d4bc48f41f0d4b8fa8933a.tar.gz
nixlib-7102388834f1cd81c4d4bc48f41f0d4b8fa8933a.tar.bz2
nixlib-7102388834f1cd81c4d4bc48f41f0d4b8fa8933a.tar.lz
nixlib-7102388834f1cd81c4d4bc48f41f0d4b8fa8933a.tar.xz
nixlib-7102388834f1cd81c4d4bc48f41f0d4b8fa8933a.tar.zst
nixlib-7102388834f1cd81c4d4bc48f41f0d4b8fa8933a.zip
Merge pull request #101139 from roberth/lib-use-static-scope-checking
lib: Use Nix's static scope checking, fix error message, optimize
Diffstat (limited to 'lib/modules.nix')
-rw-r--r--lib/modules.nix57
1 files changed, 49 insertions, 8 deletions
diff --git a/lib/modules.nix b/lib/modules.nix
index 103a22ed1312..d2d35dbaae51 100644
--- a/lib/modules.nix
+++ b/lib/modules.nix
@@ -1,12 +1,53 @@
 { lib }:
 
-with lib.lists;
-with lib.strings;
-with lib.trivial;
-with lib.attrsets;
-with lib.options;
-with lib.debug;
-with lib.types;
+let
+  inherit (lib)
+    all
+    any
+    attrByPath
+    attrNames
+    catAttrs
+    concatLists
+    concatMap
+    count
+    elem
+    filter
+    findFirst
+    flip
+    foldl
+    foldl'
+    getAttrFromPath
+    head
+    id
+    imap1
+    isAttrs
+    isBool
+    isFunction
+    isString
+    length
+    mapAttrs
+    mapAttrsToList
+    mapAttrsRecursiveCond
+    min
+    optional
+    optionalAttrs
+    optionalString
+    recursiveUpdate
+    reverseList sort
+    setAttrByPath
+    toList
+    types
+    warn
+    ;
+  inherit (lib.options)
+    isOption
+    mkOption
+    showDefs
+    showFiles
+    showOption
+    unknownModule
+    ;
+in
 
 rec {
 
@@ -616,7 +657,7 @@ rec {
   fixupOptionType = loc: opt:
     let
       options = opt.options or
-        (throw "Option `${showOption loc'}' has type optionSet but has no option attribute, in ${showFiles opt.declarations}.");
+        (throw "Option `${showOption loc}' has type optionSet but has no option attribute, in ${showFiles opt.declarations}.");
       f = tp:
         let optionSetIn = type: (tp.name == type) && (tp.functor.wrapped.name == "optionSet");
         in