infrastructure/lib/default.nix

19 lines
482 B
Nix
Raw Permalink Normal View History

2024-10-02 15:52:04 +02:00
{ pkgs, ... }:
let
lib = pkgs.lib;
foldersWithNix =
path:
let
folders = lib.attrNames (lib.filterAttrs (n: t: t == "directory") (builtins.readDir path));
isFolderWithDefaultNix = folder: lib.pathExists (lib.path.append path "./${folder}/default.nix");
in
lib.filter isFolderWithDefaultNix folders;
in
{
inherit foldersWithNix;
loadSubmodulesFrom =
path: map (folder: lib.path.append path "./${folder}/default.nix") (foldersWithNix path);
}