rewrite find module

This commit is contained in:
Daylin Morgan 2025-01-27 14:20:14 -06:00
parent dff345b9f0
commit b38b20a81b
Signed by: daylin
GPG key ID: 950D13E9719334AD
2 changed files with 21 additions and 27 deletions

View file

@ -27,7 +27,6 @@ runs:
BTRFS: ${{ inputs.btrfs }} BTRFS: ${{ inputs.btrfs }}
run: exec ${{ github.action_path }}/prepare.sh run: exec ${{ github.action_path }}/prepare.sh
- uses: daylinmorgan/lix-gha-installer-action@released - uses: daylinmorgan/lix-gha-installer-action@released
with: with:
extra-conf: ${{ inputs.nix_conf }} extra-conf: ${{ inputs.nix_conf }}

View file

@ -10,30 +10,25 @@ let
; ;
in in
rec { rec {
# https://github.com/balsoft/nixos-config/blob/73cc2c3a8bb62a9c3980a16ae70b2e97af6e1abd/flake.nix#L109-L120
findModulesList = handleModule =
dir: dir: name: type:
concatLists ( if type == "regular" then
attrValues ( [
mapAttrs ( {
name: type: name = elemAt (match "(.*)\\.nix" name) 0;
if type == "regular" then value = dir + "/${name}";
[ }
{ ]
name = elemAt (match "(.*)\\.nix" name) 0; else if (readDir (dir + "/${name}")) ? "default.nix" then
value = dir + "/${name}"; [
} {
] inherit name;
else if (readDir (dir + "/${name}")) ? "default.nix" then value = dir + "/${name}";
[ }
{ ]
inherit name; else
value = dir + "/${name}"; findModulesList (dir + "/${name}");
}
] findModulesList = dir: (readDir dir) |> mapAttrs (handleModule dir) |> attrValues |> concatLists;
else
findModulesList (dir + "/${name}")
) (readDir dir)
)
);
} }