build(xatu): add flake package #78

Closed
alexion wants to merge 8 commits from feat/package-xatu into main
3 changed files with 26 additions and 20 deletions
Showing only changes of commit 3e0bcbc0ee - Show all commits

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 =

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
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;
}