feat(ap01): WIP

This commit is contained in:
Elias Coppens 2025-02-04 21:53:21 +01:00 committed by sinavir
parent c9dc36ed08
commit 9a4f9c2ca3
No known key found for this signature in database
14 changed files with 79 additions and 16 deletions

View file

@ -111,12 +111,12 @@ in
args; args;
defaults = defaults =
{ name, nodePath, ... }: { name, ... }:
{ {
# Import the default modules # Import the default modules
imports = [ imports = [
# Import the base configuration for each node # Import the base configuration for each node
./${nodePath}/_configuration.nix ./machines/liminix/ap-v01/_configuration.nix
./modules/generic ./modules/generic
./modules/${category name} ./modules/${category name}
]; ];

View file

@ -5,6 +5,7 @@
{ {
modulesPath, modulesPath,
sourcePkgs, sourcePkgs,
name,
... ...
}: }:
{ {
@ -39,6 +40,6 @@
(import "${modulesPath}/../devices/zyxel-nwa50ax").module (import "${modulesPath}/../devices/zyxel-nwa50ax").module
]; ];
hostname = "ap01-prototype"; hostname = name;
nixpkgs.source = sourcePkgs.path; nixpkgs.source = sourcePkgs.path;
} }

View file

@ -6,10 +6,19 @@
config, config,
pkgs, pkgs,
lib, lib,
nodeMeta,
... ...
}: }:
let let
svc = config.system.service; svc = config.system.service;
inherit (nodeMeta.extraNodeSettings) building floor ap-no;
hex = x: lib.fixedWidthString 2 "0" (lib.toHexString x);
mac-1 = "02:5B:6A:${hex (building * 4)}:${hex floor}:${hex ap-no}";
mac-2 = "02:5B:6A:${hex (building * 4 + 1)}:${hex floor}:${hex ap-no}";
secrets-1 = { secrets-1 = {
ssid = "DGNum"; ssid = "DGNum";
}; };
@ -89,6 +98,10 @@ let
}; };
in in
{ {
hardware.wlanMacAddresses = {
wlan0 = mac-1;
wlan1 = mac-2;
};
services = { services = {
# wlan0 is the 2.4GHz interface. # wlan0 is the 2.4GHz interface.
hostap-1 = mkWifiSta ( hostap-1 = mkWifiSta (

View file

@ -15,18 +15,61 @@
# nixpkgs = "unstable" or "22.11"; # nixpkgs version # nixpkgs = "unstable" or "22.11"; # nixpkgs version
# } # }
{ let
ap01 = { lib = import ../../lib/nix-lib;
site = "unknown"; inherit (lib) mapFuse;
adminGroups = [ "fai" ];
hashedPassword = "$y$j9T$DMOQEWOYFHjNS0myrXp4x/$MG33VSdXGvib.99eN.AbvyVdNNJw4ERjAwK4.ULJe/A"; mkAP = building: floor: ap-no: {
"ap-v01-${builtins.toString building}-${builtins.toString floor}-${builtins.toString ap-no}" = {
site = "unknown";
adminGroups = [ "fai" ];
stateVersion = null; hashedPassword = "$y$j9T$DMOQEWOYFHjNS0myrXp4x/$MG33VSdXGvib.99eN.AbvyVdNNJw4ERjAwK4.ULJe/A";
nixpkgs = { stateVersion = null;
system = "zyxel-nwa50ax";
version = "24.05"; nixpkgs = {
system = "zyxel-nwa50ax";
version = "24.05";
};
extraNodeSettings = {
inherit building floor ap-no;
vendor-mac = null;
};
}; };
}; };
} 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

View file

@ -210,6 +210,12 @@ in
default = null; default = null;
description = "VM cluster where the VM is located"; description = "VM cluster where the VM is located";
}; };
extraNodeSettings = mkOption {
type = attrs;
default = { };
description = "Freeform attribute set to customize the node";
};
}; };
config = { config = {

View file

@ -153,10 +153,10 @@
"type": "Git", "type": "Git",
"url": "https://git.dgnum.eu/DGNum/liminix" "url": "https://git.dgnum.eu/DGNum/liminix"
}, },
"branch": "main", "branch": "mdebray/mac-personalisation",
"revision": "1322de1ee0cdb19fead79e12ab279ee0b575019a", "revision": "b129f775b2f58a820d09b11f17363ef477669668",
"url": null, "url": null,
"hash": "07nk6nik97k8a57cf17dcj3gn2lbhw1myymrxpqc2aqa3haj754k" "hash": "17vryhcd4d7ghjin03bnqnzrra17698hd12k1afkjpi2j0ag0p3z"
}, },
"linkal": { "linkal": {
"type": "Git", "type": "Git",