summary refs log tree commit diff
path: root/lib/modules.nix
diff options
context:
space:
mode:
authorSilvan Mosberger <infinisil@icloud.com>2018-04-06 18:51:10 +0200
committerJohn Ericson <Ericson2314@yahoo.com>2018-04-07 13:21:49 -0400
commite1dee4efcbffc72260025078bf8297a3b732509c (patch)
tree567b274abbd1dc708037ea7f9933bce98671167b /lib/modules.nix
parent95ece9efe5104522ed024e3858d46f17bc6aaf16 (diff)
downloadnixlib-e1dee4efcbffc72260025078bf8297a3b732509c.tar
nixlib-e1dee4efcbffc72260025078bf8297a3b732509c.tar.gz
nixlib-e1dee4efcbffc72260025078bf8297a3b732509c.tar.bz2
nixlib-e1dee4efcbffc72260025078bf8297a3b732509c.tar.lz
nixlib-e1dee4efcbffc72260025078bf8297a3b732509c.tar.xz
nixlib-e1dee4efcbffc72260025078bf8297a3b732509c.tar.zst
nixlib-e1dee4efcbffc72260025078bf8297a3b732509c.zip
lib: make extensible
This allows the lib fixed point to be extended with

  myLib = lib.extend (self: super: {
    foo = "foo";
  })

With this it's possible to have the new modified lib attrset available to all
modules when using evalModules

  myLib.evalModules {
    modules = [ ({ lib, ... }: {
      options.bar = lib.mkOption {
	default = lib.foo;
      };
    }) ];
  }

  => { config = { bar = "foo"; ... }; options = ...; }
Diffstat (limited to 'lib/modules.nix')
-rw-r--r--lib/modules.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/modules.nix b/lib/modules.nix
index acd07f732bdb..4ef982c7ec96 100644
--- a/lib/modules.nix
+++ b/lib/modules.nix
@@ -59,7 +59,7 @@ rec {
         };
       };
 
-      closed = closeModules (modules ++ [ internalModule ]) ({ inherit config options; lib = import ./.; } // specialArgs);
+      closed = closeModules (modules ++ [ internalModule ]) ({ inherit config options lib; } // specialArgs);
 
       options = mergeModules prefix (reverseList (filterModules (specialArgs.modulesPath or "") closed));