refactor(liminix): Refactor liminix meta nodes
Some checks failed
Check meta / check_meta (pull_request) Successful in 15s
Check meta / check_dns (pull_request) Successful in 16s
Check workflows / check_workflows (pull_request) Failing after 16s
Build all the nodes / netcore02 (pull_request) Successful in 21s
Run pre-commit on all files / pre-commit (push) Successful in 27s
Build all the nodes / ap01 (pull_request) Failing after 31s
Build the shell / build-shell (pull_request) Successful in 24s
Run pre-commit on all files / pre-commit (pull_request) Successful in 24s
Build all the nodes / hypervisor03 (pull_request) Successful in 1m54s
Build all the nodes / bridge01 (pull_request) Successful in 1m55s
Build all the nodes / tower01 (pull_request) Successful in 1m54s
Build all the nodes / rescue01 (pull_request) Successful in 1m57s
Build all the nodes / build01 (pull_request) Successful in 2m44s
Build all the nodes / hypervisor02 (pull_request) Successful in 2m47s
Build all the nodes / storage01 (pull_request) Successful in 3m1s
Build all the nodes / hypervisor01 (pull_request) Successful in 3m9s
Build all the nodes / geo02 (pull_request) Successful in 3m11s
Build all the nodes / geo01 (pull_request) Successful in 3m41s
Build all the nodes / vault01 (pull_request) Successful in 3m40s
Build all the nodes / web03 (pull_request) Successful in 3m29s
Build all the nodes / compute01 (pull_request) Successful in 3m46s
Build all the nodes / web01 (pull_request) Successful in 3m45s
Build all the nodes / web02 (pull_request) Successful in 3m39s

This commit is contained in:
Elias Coppens 2025-02-06 10:46:12 +01:00
parent 099fc058c8
commit 0c3062a5c5
Signed by: ecoppens
GPG key ID: 871893E37A732093

View file

@ -14,12 +14,11 @@
# deployment = {}; # Colmena deployment options
# nixpkgs = "unstable" or "22.11"; # nixpkgs version
# }
let
lib = import ../../lib/nix-lib;
inherit (lib) mapFuse;
nix-lib = import ../../lib/nix-lib;
inherit (nix-lib) mapFuse;
mkAP = building: floor: ap-no: {
mkAP' = building: floor: ap-no: {
"ap-v01-${builtins.toString building}-${builtins.toString floor}-${builtins.toString ap-no}" = {
site = "unknown";
adminGroups = [ "fai" ];
@ -39,37 +38,53 @@ let
};
};
};
/*
Generate all APs nodes for a building. It takes a building definition and returns
an attributes set containing all nodes of the AP for the building.
Building definition:
* building-no is the index of the building
* floors is the range {from, to{ of floors that contains an AP
* ap-nos is the range [from, to{ of AP numbers
Type: AttrSet -> AttrSet
*/
mkAPs-building =
{
building-no,
floors,
ap-nos,
}:
mapFuse (f: mapFuse (mkAP' building-no f) (mkRange ap-nos)) (mkRange floors);
APs = {
hypnos-1 = {
building-no = 0;
floors = {
from = 0;
to = 3;
};
ap-nos = {
from = 1;
to = 7;
};
};
hypnos-2 = {
building-no = 1;
floors = {
from = 0;
to = 3;
};
ap-nos = {
from = 1;
to = 3;
};
};
};
mkRange = { from, to }: builtins.genList (x: x + from) (to - from);
in
{ }
//
mapFuse
(
floor:
mapFuse (mkAP 0 floor) [
1
2
3
4
5
6
]
)
[
0
1
2
] # Hypnos-1
//
mapFuse
(
floor:
mapFuse (mkAP 1 floor) [
1
2
]
)
[
0
1
2
] # Hypnos-2
// builtins.foldl' (nodes: building: nodes // mkAPs-building building) { } (builtins.attrValues APs)