diff options
| author | Alejandro Soto <alejandro@34project.org> | 2022-03-08 21:00:24 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2022-03-08 21:09:54 -0600 |
| commit | 65bbf5411d8d3e30bffcc278ccace65c7e75c70c (patch) | |
| tree | 29c3e9b3e041cf68bee2947f2a66b7bf9f32982d /util | |
| parent | 3e509d0fd1034c1dd67e16ec6000e46be9dd65d9 (diff) | |
Implement shell environments
Diffstat (limited to 'util')
| -rw-r--r-- | util/default.nix | 3 | ||||
| -rw-r--r-- | util/importAll.nix | 15 |
2 files changed, 18 insertions, 0 deletions
diff --git a/util/default.nix b/util/default.nix new file mode 100644 index 0000000..226c69f --- /dev/null +++ b/util/default.nix @@ -0,0 +1,3 @@ +lib: { + importAll = import ./importAll.nix lib; +} diff --git a/util/importAll.nix b/util/importAll.nix new file mode 100644 index 0000000..c4a092e --- /dev/null +++ b/util/importAll.nix @@ -0,0 +1,15 @@ +lib: +{ root, exclude ? [] }: +with builtins; with lib; + +# http://chriswarbo.net/projects/nixos/useful_hacks.html +let + isMatch = name: type: (hasSuffix ".nix" name || type == "directory") + && ! elem name exclude; + + entry = name: _: { + name = removeSuffix ".nix" name; + value = import (root + "/${name}"); + }; +in + mapAttrs' entry (filterAttrs isMatch (readDir root)) |
