some reorganizing

This commit is contained in:
xunuwu 2025-01-16 10:08:58 +01:00
parent df9e8ae8bf
commit 113e015135
Signed by: xun
SSH key fingerprint: SHA256:Uot/1WoAjWAeqLOHA5vYy4phhVydsH7jCPmBjaPZfgI
182 changed files with 443 additions and 449 deletions

29
lib/default.nix Normal file
View file

@ -0,0 +1,29 @@
l: let
b = builtins;
in rec {
loadBranch = branch:
l.mapAttrs' (leaf: _: {
name = l.removeSuffix ".nix" leaf;
value = /${branch}/${leaf};
}) (b.readDir /${branch});
loadTree2 = dir: (l.mapAttrs (branch: _: loadBranch /${dir}/${branch})) (b.readDir dir);
loadTreeInf = dir:
l.mapAttrs' (
name: value: {
name = l.removeSuffix ".nix" name;
value =
if value == "directory"
then loadTreeInf (dir + /${name})
else (dir + /${name});
}
) (b.readDir dir);
loadConfigurations = dir: specialArgs:
(b.mapAttrs (name: _:
l.nixosSystem {
modules = [(dir + /${name})];
inherit specialArgs;
})) (b.readDir dir);
}