refactor(flake): move shared utility functions

This commit is contained in:
2026-09-19 16:30:46 -04:00
parent c5043a67be
commit 3e0bcbc0ee
3 changed files with 26 additions and 20 deletions

22
src/flake/util.nix Normal file
View File

@@ -0,0 +1,22 @@
{ lib }:
let
collectNixFiles =
dir:
lib.flatten (
lib.mapAttrsToList (
name: type:
let
path = dir + "/${name}";
in
if type == "directory" then
collectNixFiles path
else if type == "regular" && lib.hasSuffix ".nix" name then
[ path ]
else
[ ]
) (builtins.readDir dir)
);
in
{
inherit collectNixFiles;
}