diff options
Diffstat (limited to '')
| -rw-r--r-- | pkgs/lib/default.nix | 5 | ||||
| -rw-r--r-- | pkgs/lib/importAll.nix | 31 |
2 files changed, 19 insertions, 17 deletions
diff --git a/pkgs/lib/default.nix b/pkgs/lib/default.nix index a273758..e3ab56e 100644 --- a/pkgs/lib/default.nix +++ b/pkgs/lib/default.nix @@ -1,4 +1,3 @@ -{ callPackage }: -{ - importAll = callPackage ./importAll.nix { }; +{callPackage}: { + importAll = callPackage ./importAll.nix {}; } diff --git a/pkgs/lib/importAll.nix b/pkgs/lib/importAll.nix index 30a1dd9..6acabe9 100644 --- a/pkgs/lib/importAll.nix +++ b/pkgs/lib/importAll.nix @@ -1,17 +1,20 @@ -{ lib }: -{ root, exclude ? [ ] }: -with builtins; with lib; - +{lib}: { + root, + exclude ? [], +}: +with builtins; +with lib; # http://chriswarbo.net/projects/nixos/useful_hacks.html -let - basename = removeSuffix ".nix"; + let + basename = removeSuffix ".nix"; - isMatch = name: type: (hasSuffix ".nix" name || type == "directory") - && ! elem name (map basename exclude); + isMatch = name: type: + (hasSuffix ".nix" name || type == "directory") + && ! elem name (map basename exclude); - entry = name: _: { - name = basename name; - value = import (root + "/${name}"); - }; -in -mapAttrs' entry (filterAttrs isMatch (readDir root)) + entry = name: _: { + name = basename name; + value = import (root + "/${name}"); + }; + in + mapAttrs' entry (filterAttrs isMatch (readDir root)) |
