2024-12-16 09:34:15 +01:00
|
|
|
# SPDX-FileCopyrightText: 2024 Tom Hubrecht <tom.hubrecht@dgnum.eu>
|
|
|
|
# SPDX-FileContributor: Ryan Lahfa <ryan.lahfa@dgnum.eu>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: EUPL-1.2
|
|
|
|
|
2024-12-09 10:20:44 +01:00
|
|
|
###
|
|
|
|
# File specifying all the deployement options for the nodes administrated by the dgnum.
|
|
|
|
#
|
|
|
|
# Node metadata template is:
|
|
|
|
#
|
|
|
|
# NODE_NAME = {
|
|
|
|
# adminGroups = []; # List of groups that have root access
|
|
|
|
# admins = []; # List of individuals that have root access
|
|
|
|
# deployment = {}; # Colmena deployment options
|
|
|
|
# nixpkgs = "unstable" or "22.11"; # nixpkgs version
|
|
|
|
# }
|
2025-02-04 21:53:21 +01:00
|
|
|
let
|
2025-02-06 10:46:12 +01:00
|
|
|
nix-lib = import ../../lib/nix-lib;
|
|
|
|
inherit (nix-lib) mapFuse;
|
2024-12-09 10:20:44 +01:00
|
|
|
|
2025-02-12 09:52:06 +01:00
|
|
|
mkAP' = permutations: building: floor: ap-no: {
|
2025-02-04 21:53:21 +01:00
|
|
|
"ap-v01-${builtins.toString building}-${builtins.toString floor}-${builtins.toString ap-no}" = {
|
|
|
|
site = "unknown";
|
|
|
|
adminGroups = [ "fai" ];
|
2024-12-09 10:20:44 +01:00
|
|
|
|
2025-02-04 21:53:21 +01:00
|
|
|
hashedPassword = "$y$j9T$DMOQEWOYFHjNS0myrXp4x/$MG33VSdXGvib.99eN.AbvyVdNNJw4ERjAwK4.ULJe/A";
|
2024-12-09 10:20:44 +01:00
|
|
|
|
2025-02-04 21:53:21 +01:00
|
|
|
stateVersion = null;
|
|
|
|
|
|
|
|
nixpkgs = {
|
|
|
|
system = "zyxel-nwa50ax";
|
|
|
|
version = "24.05";
|
|
|
|
};
|
|
|
|
|
|
|
|
extraNodeSettings = {
|
|
|
|
inherit building floor ap-no;
|
2025-02-12 09:52:06 +01:00
|
|
|
real-ap-no = (builtins.elemAt (builtins.elemAt permutations floor) (ap-no - 1)) - 1;
|
2025-02-04 21:53:21 +01:00
|
|
|
vendor-mac = null;
|
|
|
|
};
|
2024-12-09 10:20:44 +01:00
|
|
|
};
|
|
|
|
};
|
2025-02-06 10:46:12 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
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,
|
2025-02-12 09:52:06 +01:00
|
|
|
permutations,
|
2025-02-06 10:46:12 +01:00
|
|
|
}:
|
2025-02-12 09:52:06 +01:00
|
|
|
mapFuse (f: mapFuse (mkAP' permutations building-no f) (mkRange ap-nos)) (mkRange floors);
|
2025-02-06 10:46:12 +01:00
|
|
|
|
|
|
|
APs = {
|
|
|
|
hypnos-1 = {
|
|
|
|
building-no = 0;
|
|
|
|
floors = {
|
|
|
|
from = 0;
|
|
|
|
to = 3;
|
|
|
|
};
|
|
|
|
ap-nos = {
|
|
|
|
from = 1;
|
|
|
|
to = 7;
|
|
|
|
};
|
2025-02-12 09:52:06 +01:00
|
|
|
permutations = [
|
|
|
|
[
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
5
|
|
|
|
6
|
|
|
|
4
|
|
|
|
]
|
|
|
|
[
|
|
|
|
1
|
|
|
|
2
|
|
|
|
6
|
|
|
|
3
|
|
|
|
5
|
|
|
|
4
|
|
|
|
]
|
|
|
|
[
|
|
|
|
1
|
|
|
|
2
|
|
|
|
5
|
|
|
|
3
|
|
|
|
6
|
|
|
|
4
|
|
|
|
]
|
|
|
|
];
|
2025-02-06 10:46:12 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
hypnos-2 = {
|
|
|
|
building-no = 1;
|
|
|
|
floors = {
|
|
|
|
from = 0;
|
|
|
|
to = 3;
|
|
|
|
};
|
|
|
|
ap-nos = {
|
|
|
|
from = 1;
|
|
|
|
to = 3;
|
|
|
|
};
|
2025-02-12 09:52:06 +01:00
|
|
|
permutations = [
|
|
|
|
[
|
|
|
|
1
|
|
|
|
2
|
|
|
|
]
|
|
|
|
[
|
|
|
|
1
|
|
|
|
2
|
|
|
|
]
|
|
|
|
[
|
|
|
|
1
|
|
|
|
2
|
|
|
|
]
|
|
|
|
];
|
2025-02-06 10:46:12 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
mkRange = { from, to }: builtins.genList (x: x + from) (to - from);
|
2025-02-04 21:53:21 +01:00
|
|
|
in
|
|
|
|
{ }
|
2025-02-06 10:46:12 +01:00
|
|
|
// builtins.foldl' (nodes: building: nodes // mkAPs-building building) { } (builtins.attrValues APs)
|