98 lines
1.8 KiB
Nix
98 lines
1.8 KiB
Nix
|
# SPDX-FileCopyrightText: 2025 Lubin Bailly <lubin.bailly@dgnum.eu>
|
||
|
#
|
||
|
# SPDX-License-Identifier: EUPL-1.2
|
||
|
|
||
|
{
|
||
|
config,
|
||
|
lib,
|
||
|
...
|
||
|
}:
|
||
|
let
|
||
|
inherit (lib)
|
||
|
mkEnableOption
|
||
|
mkIf
|
||
|
mkOption
|
||
|
;
|
||
|
inherit (lib.types)
|
||
|
listOf
|
||
|
str
|
||
|
;
|
||
|
cfg = config.dgn-isp;
|
||
|
in
|
||
|
{
|
||
|
options.dgn-isp = {
|
||
|
enable = mkEnableOption "Common isp configuration";
|
||
|
|
||
|
AP = mkOption {
|
||
|
type = listOf str;
|
||
|
default = [ ];
|
||
|
description = ''
|
||
|
Interfaces connected to one of our Access Point.
|
||
|
'';
|
||
|
};
|
||
|
|
||
|
staging-AP = mkOption {
|
||
|
type = listOf str;
|
||
|
default = [ ];
|
||
|
description = ''
|
||
|
Interfaces connected to one of our Access Point being deployed.
|
||
|
'';
|
||
|
};
|
||
|
|
||
|
admin-ip = mkOption {
|
||
|
type = str;
|
||
|
description = ''
|
||
|
Administrative IPv6.
|
||
|
'';
|
||
|
};
|
||
|
};
|
||
|
config = mkIf cfg.enable {
|
||
|
vlans = {
|
||
|
"uplink-cri".id = 223;
|
||
|
|
||
|
"admin-core" = {
|
||
|
id = 3000;
|
||
|
l3-interface = "irb.0";
|
||
|
};
|
||
|
"admin-ap".id = 3001;
|
||
|
"users".id-list = [
|
||
|
{
|
||
|
begin = 3045;
|
||
|
end = 4094;
|
||
|
}
|
||
|
];
|
||
|
|
||
|
"ap-staging".id = 2000;
|
||
|
"hypervisor".id = 2001;
|
||
|
};
|
||
|
|
||
|
dgn-interfaces."irb".inet6.addresses = [ cfg.admin-ip ];
|
||
|
|
||
|
dgn-profiles = {
|
||
|
AP = {
|
||
|
interfaces = cfg.AP;
|
||
|
configuration = {
|
||
|
poe = true;
|
||
|
ethernet-switching = {
|
||
|
interface-mode = "trunk";
|
||
|
vlans = [
|
||
|
"users"
|
||
|
"admin-ap"
|
||
|
];
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
staging-AP = {
|
||
|
interfaces = cfg.staging-AP;
|
||
|
configuration = {
|
||
|
poe = true;
|
||
|
ethernet-switching = {
|
||
|
interface-mode = "access";
|
||
|
vlans = [ "ap-staging" ];
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
}
|