diff options
| author | Alejandro Soto <alejandro@34project.org> | 2025-08-06 14:05:49 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2025-08-06 14:36:55 -0600 |
| commit | ccfca16452e91705330abc09cea1f9dd897c00f7 (patch) | |
| tree | 495bfd35153d707eb835c3cc059df5144bc66c81 /doctrine/lib/import-all.nix | |
| parent | f2bffec80259b1a7902bd91166f4982edc9dc363 (diff) | |
doctrine/lib: rename importAll.nix -> import-all.nix
Diffstat (limited to 'doctrine/lib/import-all.nix')
| -rw-r--r-- | doctrine/lib/import-all.nix | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/doctrine/lib/import-all.nix b/doctrine/lib/import-all.nix new file mode 100644 index 0000000..423dd9c --- /dev/null +++ b/doctrine/lib/import-all.nix @@ -0,0 +1,21 @@ +{ + lib, + root, + exclude ? ["default"], +}: +with builtins; +with lib; +# http://chriswarbo.net/projects/nixos/useful_hacks.html + let + basename = removeSuffix ".nix"; + + isMatch = name: type: + (hasSuffix ".nix" name || type == "directory") + && ! elem (basename name) exclude; + + entry = name: _: { + name = basename name; + value = import (root + "/${name}"); + }; + in + mapAttrs' entry (filterAttrs isMatch (readDir root)) |
