Something went wrong. Try again.
A Nordic stronghold for declarative computing.
flakes nix nixos nix-darwin
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576{ lib }:
dir:
let inherit (builtins) readDir attrNames filter match pathExists;
inherit (lib) concatLists hasPrefix;
entries = readDir dir;
names = attrNames entries;
validName = name: !(hasPrefix "_" name);
recurse = name: let type = entries.${name}; path = dir + "/${name}"; in if !validName name then [ ]
else if type == "directory" then importTree path
else if type == "regular" && name != "default.nix" && match ".*\\.nix" name != null then [ path ]
else [ ];
importTree = d: let dEntries = readDir d; dNames = attrNames dEntries; in concatLists (map (name: let type = dEntries.${name}; path = d + "/${name}"; in if !validName name then [ ]
else if type == "directory" then importTree path
else if type == "regular" && name != "import-tree.nix" && name != "flake.nix" && name != "flake.lock" && match ".*\\.nix" name != null then [ path ]
else [ ] ) dNames);
inimportTree dir