feat(dotfiles): migrate flake scaffolding

This commit is contained in:
2026-08-30 19:44:23 -04:00
parent 7a6dc4d6f3
commit ba4fbb984a
8 changed files with 1408 additions and 18 deletions

32
src/dotfiles/util.nix Normal file
View File

@@ -0,0 +1,32 @@
{ 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;
bridgeName = id: "br-vlan${toString id}";
deriveMac =
name:
let
hash = builtins.hashString "sha256" name;
octet = i: builtins.substring (i * 2) 2 hash;
in
lib.concatStringsSep ":" ([ "02" ] ++ map octet [ 0 1 2 3 4 ]);
}