# SPDX-FileCopyrightText: 2024 Tom Hubrecht # SPDX-FileContributor: Ryan Lahfa # # SPDX-License-Identifier: EUPL-1.2 ### # 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 # } let nix-lib = import ../../lib/nix-lib; inherit (nix-lib) mapFuse; mkAP' = building: floor: ap-no: { "ap-v01-${builtins.toString building}-${builtins.toString floor}-${builtins.toString ap-no}" = { site = "unknown"; adminGroups = [ "fai" ]; hashedPassword = "$y$j9T$DMOQEWOYFHjNS0myrXp4x/$MG33VSdXGvib.99eN.AbvyVdNNJw4ERjAwK4.ULJe/A"; stateVersion = null; nixpkgs = { system = "zyxel-nwa50ax"; version = "24.05"; }; extraNodeSettings = { inherit building floor ap-no; vendor-mac = null; }; }; }; /* 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 { } // builtins.foldl' (nodes: building: nodes // mkAPs-building building) { } (builtins.attrValues APs)