From ccfca16452e91705330abc09cea1f9dd897c00f7 Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Wed, 6 Aug 2025 14:05:49 -0600 Subject: doctrine/lib: rename importAll.nix -> import-all.nix --- doctrine/lib/import-all.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 doctrine/lib/import-all.nix (limited to 'doctrine/lib/import-all.nix') 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)) -- cgit v1.2.3