flake: initial commit

This commit is contained in:
Alejandro Soto 2025-01-26 15:07:06 -06:00
parent 6f35544dcd
commit 4b8609385a
6 changed files with 207 additions and 0 deletions

20
pkgs/lib/importAll.nix Normal file
View file

@ -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))