mirror of
https://github.com/daylinmorgan/oizys.git
synced 2025-02-02 11:04:17 -06:00
rewrite find module
This commit is contained in:
parent
dff345b9f0
commit
b38b20a81b
2 changed files with 21 additions and 27 deletions
1
.github/actions/nix/action.yml
vendored
1
.github/actions/nix/action.yml
vendored
|
@ -27,7 +27,6 @@ runs:
|
|||
BTRFS: ${{ inputs.btrfs }}
|
||||
run: exec ${{ github.action_path }}/prepare.sh
|
||||
|
||||
|
||||
- uses: daylinmorgan/lix-gha-installer-action@released
|
||||
with:
|
||||
extra-conf: ${{ inputs.nix_conf }}
|
||||
|
|
|
@ -10,30 +10,25 @@ let
|
|||
;
|
||||
in
|
||||
rec {
|
||||
# https://github.com/balsoft/nixos-config/blob/73cc2c3a8bb62a9c3980a16ae70b2e97af6e1abd/flake.nix#L109-L120
|
||||
findModulesList =
|
||||
dir:
|
||||
concatLists (
|
||||
attrValues (
|
||||
mapAttrs (
|
||||
name: type:
|
||||
if type == "regular" then
|
||||
[
|
||||
{
|
||||
name = elemAt (match "(.*)\\.nix" name) 0;
|
||||
value = dir + "/${name}";
|
||||
}
|
||||
]
|
||||
else if (readDir (dir + "/${name}")) ? "default.nix" then
|
||||
[
|
||||
{
|
||||
inherit name;
|
||||
value = dir + "/${name}";
|
||||
}
|
||||
]
|
||||
else
|
||||
findModulesList (dir + "/${name}")
|
||||
) (readDir dir)
|
||||
)
|
||||
);
|
||||
|
||||
handleModule =
|
||||
dir: name: type:
|
||||
if type == "regular" then
|
||||
[
|
||||
{
|
||||
name = elemAt (match "(.*)\\.nix" name) 0;
|
||||
value = dir + "/${name}";
|
||||
}
|
||||
]
|
||||
else if (readDir (dir + "/${name}")) ? "default.nix" then
|
||||
[
|
||||
{
|
||||
inherit name;
|
||||
value = dir + "/${name}";
|
||||
}
|
||||
]
|
||||
else
|
||||
findModulesList (dir + "/${name}");
|
||||
|
||||
findModulesList = dir: (readDir dir) |> mapAttrs (handleModule dir) |> attrValues |> concatLists;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue