home-manager kat user refactor

This commit is contained in:
kat witch 2021-08-05 21:47:54 +01:00
parent b1f27aa74d
commit 1230ff387b
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
13 changed files with 34 additions and 82 deletions

View file

@ -1,8 +1,9 @@
{ modulesDir, defaultFile ? "default.nix", importAll ? false }:
{ lib }: { modulesDir, defaultFile ? "default.nix", importAll ? false }:
with builtins;
let
isModule = m: lib.isFunction m && (m.isModule or true);
filterAttrNamesToList = filter: set:
foldl' (a: b: a ++ b) [ ]
(map (e: if (filter e set.${e}) then [ e ] else [ ]) (attrNames set));
@ -20,7 +21,7 @@ let
in
{
inherit name;
value = if (isFunction m) && !importAll then value else m;
value = if lib.isFunction m && ! isModule m then m { inherit lib; } else if isModule m && !importAll then value else m;
})
files;
in