refactor(flake): move shared utility functions

This commit is contained in:
alexion committed 2026-09-19 16:30:46 -04:00
1 parent c5043a67be
commit 3e0bcbc0ee
3 files changed
+26 -20

No files matched your search

+3 -19
View File
@@ -1,25 +1,9 @@
{ 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)
);
flakeUtil = import ../flake/util.nix { inherit lib; };
in
{
inherit collectNixFiles;
flakeUtil
// {
bridgeName = id: "br-vlan${toString id}";
deriveMac =
+1 -1
View File
@@ -6,7 +6,7 @@
system,
}:
let
util = import ../dotfiles/util.nix { inherit lib; };
util = import ./util.nix { inherit lib; };
dotfiles = import ../dotfiles {
inherit
+22
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;
}