From 578b0c59aa75fedf7594d4ce95b2038cc53f53cd Mon Sep 17 00:00:00 2001 From: Fabian Montero Date: Tue, 5 Aug 2025 23:22:16 -0600 Subject: add doctrine --- doctrine/lib/importAll.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 doctrine/lib/importAll.nix (limited to 'doctrine/lib/importAll.nix') diff --git a/doctrine/lib/importAll.nix b/doctrine/lib/importAll.nix new file mode 100644 index 0000000..6acabe9 --- /dev/null +++ b/doctrine/lib/importAll.nix @@ -0,0 +1,20 @@ +{lib}: { + root, + exclude ? [], +}: +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 name (map basename exclude); + + entry = name: _: { + name = basename name; + value = import (root + "/${name}"); + }; + in + mapAttrs' entry (filterAttrs isMatch (readDir root)) -- cgit v1.2.3