revert(hackdays): remove all infra dedicated to hackdays
All checks were successful
Check meta / check_dns (pull_request) Successful in 16s
Check meta / check_meta (pull_request) Successful in 17s
Check workflows / check_workflows (pull_request) Successful in 17s
Build all the nodes / Jaccess04 (pull_request) Successful in 24s
Build all the nodes / Jaccess01 (pull_request) Successful in 26s
Run pre-commit on all files / pre-commit (pull_request) Successful in 31s
Build all the nodes / ap01 (pull_request) Successful in 41s
Build all the nodes / bridge01 (pull_request) Successful in 47s
Build all the nodes / netcore01 (pull_request) Successful in 24s
Build all the nodes / netcore02 (pull_request) Successful in 24s
Build all the nodes / hypervisor02 (pull_request) Successful in 56s
Build all the nodes / hypervisor01 (pull_request) Successful in 59s
Build all the nodes / cof02 (pull_request) Successful in 1m4s
Build all the nodes / geo02 (pull_request) Successful in 1m5s
Build all the nodes / hypervisor03 (pull_request) Successful in 1m4s
Build all the nodes / geo01 (pull_request) Successful in 1m6s
Build all the nodes / iso (pull_request) Successful in 1m8s
Build all the nodes / build01 (pull_request) Successful in 1m10s
Build all the nodes / lab-router01 (pull_request) Successful in 55s
Build all the nodes / compute01 (pull_request) Successful in 1m21s
Build the shell / build-shell (pull_request) Successful in 21s
Build all the nodes / rescue01 (pull_request) Successful in 1m7s
Build all the nodes / tower01 (pull_request) Successful in 47s
Build all the nodes / vault01 (pull_request) Successful in 56s
Build all the nodes / zulip01 (pull_request) Successful in 51s
Build all the nodes / krz01 (pull_request) Successful in 1m42s
Build all the nodes / web02 (pull_request) Successful in 59s
Build all the nodes / web03 (pull_request) Successful in 58s
Build all the nodes / web01 (pull_request) Successful in 1m10s
Build all the nodes / storage01 (pull_request) Successful in 1m24s
Build all the nodes / Jaccess01 (push) Successful in 20s
Build all the nodes / Jaccess04 (push) Successful in 21s
Run pre-commit on all files / pre-commit (push) Successful in 27s
Build all the nodes / ap01 (push) Successful in 37s
Build all the nodes / bridge01 (push) Successful in 41s
Build all the nodes / build01 (push) Successful in 50s
Build all the nodes / cof02 (push) Successful in 46s
Build all the nodes / geo01 (push) Successful in 41s
Build all the nodes / geo02 (push) Successful in 48s
Build all the nodes / compute01 (push) Successful in 1m16s
Build all the nodes / hypervisor01 (push) Successful in 41s
Build all the nodes / hypervisor03 (push) Successful in 42s
Build all the nodes / hypervisor02 (push) Successful in 49s
Build all the nodes / iso (push) Successful in 58s
Build all the nodes / lab-router01 (push) Successful in 50s
Build all the nodes / netcore01 (push) Successful in 19s
Build all the nodes / netcore02 (push) Successful in 20s
Build all the nodes / krz01 (push) Successful in 1m25s
Build all the nodes / rescue01 (push) Successful in 1m0s
Build all the nodes / tower01 (push) Successful in 42s
Build all the nodes / vault01 (push) Successful in 50s
Build all the nodes / storage01 (push) Successful in 1m47s
Build all the nodes / web01 (push) Successful in 1m0s
Build all the nodes / web02 (push) Successful in 42s
Build all the nodes / web03 (push) Successful in 48s
Build the shell / build-shell (push) Successful in 20s
Build all the nodes / zulip01 (push) Successful in 43s

This commit is contained in:
catvayor 2025-06-05 17:06:45 +02:00
parent 4b6f200c31
commit 2fe8b66fa2
Signed by: lbailly
GPG key ID: CE3E645251AC63F3
19 changed files with 26 additions and 574 deletions

View file

@ -362,234 +362,6 @@ jobs:
name: Cache storage01
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\npush-to-cache \"$STORE_PATH\"\n'"
swHackdays01:
runs-on: nix-infra
steps:
- uses: actions/checkout@v3
- env:
BUILD_NODE: swHackdays01
name: Eval swHackdays01
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\nDRV=$(instantiate-node)\necho \"DRV=$DRV\" >> $GITHUB_ENV\n'"
- name: Build swHackdays01
run: "STORE_PATH=\"$(nix-store --realise \"$DRV\")\"\necho \"STORE_PATH=$STORE_PATH\"\
\ >> $GITHUB_ENV\n"
- env:
STORE_ENDPOINT: https://snix-store.dgnum.eu/infra.signing/
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
STORE_USER: admin
name: Cache swHackdays01
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\npush-to-cache \"$STORE_PATH\"\n'"
swHackdays02:
runs-on: nix-infra
steps:
- uses: actions/checkout@v3
- env:
BUILD_NODE: swHackdays02
name: Eval swHackdays02
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\nDRV=$(instantiate-node)\necho \"DRV=$DRV\" >> $GITHUB_ENV\n'"
- name: Build swHackdays02
run: "STORE_PATH=\"$(nix-store --realise \"$DRV\")\"\necho \"STORE_PATH=$STORE_PATH\"\
\ >> $GITHUB_ENV\n"
- env:
STORE_ENDPOINT: https://snix-store.dgnum.eu/infra.signing/
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
STORE_USER: admin
name: Cache swHackdays02
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\npush-to-cache \"$STORE_PATH\"\n'"
swHackdays03:
runs-on: nix-infra
steps:
- uses: actions/checkout@v3
- env:
BUILD_NODE: swHackdays03
name: Eval swHackdays03
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\nDRV=$(instantiate-node)\necho \"DRV=$DRV\" >> $GITHUB_ENV\n'"
- name: Build swHackdays03
run: "STORE_PATH=\"$(nix-store --realise \"$DRV\")\"\necho \"STORE_PATH=$STORE_PATH\"\
\ >> $GITHUB_ENV\n"
- env:
STORE_ENDPOINT: https://snix-store.dgnum.eu/infra.signing/
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
STORE_USER: admin
name: Cache swHackdays03
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\npush-to-cache \"$STORE_PATH\"\n'"
swHackdays04:
runs-on: nix-infra
steps:
- uses: actions/checkout@v3
- env:
BUILD_NODE: swHackdays04
name: Eval swHackdays04
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\nDRV=$(instantiate-node)\necho \"DRV=$DRV\" >> $GITHUB_ENV\n'"
- name: Build swHackdays04
run: "STORE_PATH=\"$(nix-store --realise \"$DRV\")\"\necho \"STORE_PATH=$STORE_PATH\"\
\ >> $GITHUB_ENV\n"
- env:
STORE_ENDPOINT: https://snix-store.dgnum.eu/infra.signing/
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
STORE_USER: admin
name: Cache swHackdays04
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\npush-to-cache \"$STORE_PATH\"\n'"
swHackdays05:
runs-on: nix-infra
steps:
- uses: actions/checkout@v3
- env:
BUILD_NODE: swHackdays05
name: Eval swHackdays05
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\nDRV=$(instantiate-node)\necho \"DRV=$DRV\" >> $GITHUB_ENV\n'"
- name: Build swHackdays05
run: "STORE_PATH=\"$(nix-store --realise \"$DRV\")\"\necho \"STORE_PATH=$STORE_PATH\"\
\ >> $GITHUB_ENV\n"
- env:
STORE_ENDPOINT: https://snix-store.dgnum.eu/infra.signing/
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
STORE_USER: admin
name: Cache swHackdays05
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\npush-to-cache \"$STORE_PATH\"\n'"
swHackdays06:
runs-on: nix-infra
steps:
- uses: actions/checkout@v3
- env:
BUILD_NODE: swHackdays06
name: Eval swHackdays06
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\nDRV=$(instantiate-node)\necho \"DRV=$DRV\" >> $GITHUB_ENV\n'"
- name: Build swHackdays06
run: "STORE_PATH=\"$(nix-store --realise \"$DRV\")\"\necho \"STORE_PATH=$STORE_PATH\"\
\ >> $GITHUB_ENV\n"
- env:
STORE_ENDPOINT: https://snix-store.dgnum.eu/infra.signing/
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
STORE_USER: admin
name: Cache swHackdays06
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\npush-to-cache \"$STORE_PATH\"\n'"
swHackdays07:
runs-on: nix-infra
steps:
- uses: actions/checkout@v3
- env:
BUILD_NODE: swHackdays07
name: Eval swHackdays07
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\nDRV=$(instantiate-node)\necho \"DRV=$DRV\" >> $GITHUB_ENV\n'"
- name: Build swHackdays07
run: "STORE_PATH=\"$(nix-store --realise \"$DRV\")\"\necho \"STORE_PATH=$STORE_PATH\"\
\ >> $GITHUB_ENV\n"
- env:
STORE_ENDPOINT: https://snix-store.dgnum.eu/infra.signing/
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
STORE_USER: admin
name: Cache swHackdays07
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\npush-to-cache \"$STORE_PATH\"\n'"
swHackdays08:
runs-on: nix-infra
steps:
- uses: actions/checkout@v3
- env:
BUILD_NODE: swHackdays08
name: Eval swHackdays08
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\nDRV=$(instantiate-node)\necho \"DRV=$DRV\" >> $GITHUB_ENV\n'"
- name: Build swHackdays08
run: "STORE_PATH=\"$(nix-store --realise \"$DRV\")\"\necho \"STORE_PATH=$STORE_PATH\"\
\ >> $GITHUB_ENV\n"
- env:
STORE_ENDPOINT: https://snix-store.dgnum.eu/infra.signing/
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
STORE_USER: admin
name: Cache swHackdays08
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\npush-to-cache \"$STORE_PATH\"\n'"
swHackdays09:
runs-on: nix-infra
steps:
- uses: actions/checkout@v3
- env:
BUILD_NODE: swHackdays09
name: Eval swHackdays09
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\nDRV=$(instantiate-node)\necho \"DRV=$DRV\" >> $GITHUB_ENV\n'"
- name: Build swHackdays09
run: "STORE_PATH=\"$(nix-store --realise \"$DRV\")\"\necho \"STORE_PATH=$STORE_PATH\"\
\ >> $GITHUB_ENV\n"
- env:
STORE_ENDPOINT: https://snix-store.dgnum.eu/infra.signing/
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
STORE_USER: admin
name: Cache swHackdays09
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\npush-to-cache \"$STORE_PATH\"\n'"
swHackdays10:
runs-on: nix-infra
steps:
- uses: actions/checkout@v3
- env:
BUILD_NODE: swHackdays10
name: Eval swHackdays10
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\nDRV=$(instantiate-node)\necho \"DRV=$DRV\" >> $GITHUB_ENV\n'"
- name: Build swHackdays10
run: "STORE_PATH=\"$(nix-store --realise \"$DRV\")\"\necho \"STORE_PATH=$STORE_PATH\"\
\ >> $GITHUB_ENV\n"
- env:
STORE_ENDPOINT: https://snix-store.dgnum.eu/infra.signing/
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
STORE_USER: admin
name: Cache swHackdays10
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\npush-to-cache \"$STORE_PATH\"\n'"
swHackdays11:
runs-on: nix-infra
steps:
- uses: actions/checkout@v3
- env:
BUILD_NODE: swHackdays11
name: Eval swHackdays11
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\nDRV=$(instantiate-node)\necho \"DRV=$DRV\" >> $GITHUB_ENV\n'"
- name: Build swHackdays11
run: "STORE_PATH=\"$(nix-store --realise \"$DRV\")\"\necho \"STORE_PATH=$STORE_PATH\"\
\ >> $GITHUB_ENV\n"
- env:
STORE_ENDPOINT: https://snix-store.dgnum.eu/infra.signing/
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
STORE_USER: admin
name: Cache swHackdays11
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\npush-to-cache \"$STORE_PATH\"\n'"
swHackdays12:
runs-on: nix-infra
steps:
- uses: actions/checkout@v3
- env:
BUILD_NODE: swHackdays12
name: Eval swHackdays12
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\nDRV=$(instantiate-node)\necho \"DRV=$DRV\" >> $GITHUB_ENV\n'"
- name: Build swHackdays12
run: "STORE_PATH=\"$(nix-store --realise \"$DRV\")\"\necho \"STORE_PATH=$STORE_PATH\"\
\ >> $GITHUB_ENV\n"
- env:
STORE_ENDPOINT: https://snix-store.dgnum.eu/infra.signing/
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
STORE_USER: admin
name: Cache swHackdays12
run: "nix-shell -A eval-nodes --run 'set -o pipefail\nset -o nounset\nset -o
errexit\npush-to-cache \"$STORE_PATH\"\n'"
tower01:
runs-on: nix-infra
steps:

View file

@ -8,8 +8,6 @@
extensions = [ "EX4400-EM-4Y" ];
};
vlans."hackdays".id = 999;
dgn-isp = {
enable = true;
admin-ip = "fd26:baf9:d250:8000::1010/64";
@ -26,18 +24,8 @@
vlans = [ "uplink-cri" ];
};
"xe-0/0/0".ethernet-switching.vlans = [ "uplink-cri" ];
"xe-0/0/21".ethernet-switching.vlans = [
"all"
"hackdays"
];
"xe-0/0/22".ethernet-switching.vlans = [
"all"
"hackdays"
];
"xe-0/0/20".ethernet-switching = {
interface-mode = "access";
vlans = [ "hackdays" ];
};
"xe-0/0/21".ethernet-switching.vlans = [ "all" ];
"xe-0/0/22".ethernet-switching.vlans = [ "all" ];
# debug management
"me0".inet.addresses = [ "192.168.2.3/24" ];

View file

@ -44,20 +44,10 @@
};
};
};
vlans."hackdays".id = 999;
dgn-interfaces = {
"xe-0/2/0".ethernet-switching = {
interface-mode = "trunk";
vlans = [
"all"
"hackdays"
];
};
"ge-0/0/30".ethernet-switching = {
interface-mode = "access";
vlans = [ "hackdays" ];
rstp = false;
vlans = [ "all" ];
};
# debug management

View file

@ -1,10 +0,0 @@
# SPDX-FileCopyrightText: 2025 Lubin Bailly <lubin.bailly@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
{
dgn-hackdays = {
enable = true;
index = 1;
};
}

View file

@ -1,10 +0,0 @@
# SPDX-FileCopyrightText: 2025 Lubin Bailly <lubin.bailly@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
{
dgn-hackdays = {
enable = true;
index = 2;
};
}

View file

@ -1,10 +0,0 @@
# SPDX-FileCopyrightText: 2025 Lubin Bailly <lubin.bailly@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
{
dgn-hackdays = {
enable = true;
index = 3;
};
}

View file

@ -1,10 +0,0 @@
# SPDX-FileCopyrightText: 2025 Lubin Bailly <lubin.bailly@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
{
dgn-hackdays = {
enable = true;
index = 4;
};
}

View file

@ -1,22 +0,0 @@
# SPDX-FileCopyrightText: 2025 Lubin Bailly <lubin.bailly@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
{ lib, ... }:
let
inherit (lib) genList;
in
{
dgn-hackdays = {
enable = true;
portConfig = false;
index = 5;
};
dgn-profiles = {
"client".interfaces = genList (i: "ge-0/0/${toString i}") 45 ++ [ "ge-0/0/46" ];
"uplink".interfaces = [
"ge-0/0/45"
"ge-0/0/47"
];
};
}

View file

@ -1,10 +0,0 @@
# SPDX-FileCopyrightText: 2025 Lubin Bailly <lubin.bailly@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
{
dgn-hackdays = {
enable = true;
index = 6;
};
}

View file

@ -1,10 +0,0 @@
# SPDX-FileCopyrightText: 2025 Lubin Bailly <lubin.bailly@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
{
dgn-hackdays = {
enable = true;
index = 7;
};
}

View file

@ -1,10 +0,0 @@
# SPDX-FileCopyrightText: 2025 Lubin Bailly <lubin.bailly@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
{
dgn-hackdays = {
enable = true;
index = 8;
};
}

View file

@ -1,22 +0,0 @@
# SPDX-FileCopyrightText: 2025 Lubin Bailly <lubin.bailly@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
{ lib, ... }:
let
inherit (lib) genList;
in
{
dgn-hackdays = {
enable = true;
portConfig = false;
index = 9;
};
dgn-profiles = {
"client".interfaces = genList (i: "ge-0/0/${toString i}") 45 ++ [ "ge-0/0/46" ];
"uplink".interfaces = [
"ge-0/0/45"
"ge-0/0/47"
];
};
}

View file

@ -1,10 +0,0 @@
# SPDX-FileCopyrightText: 2025 Lubin Bailly <lubin.bailly@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
{
dgn-hackdays = {
enable = true;
index = 10;
};
}

View file

@ -1,10 +0,0 @@
# SPDX-FileCopyrightText: 2025 Lubin Bailly <lubin.bailly@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
{
dgn-hackdays = {
enable = true;
index = 11;
};
}

View file

@ -1,10 +0,0 @@
# SPDX-FileCopyrightText: 2025 Lubin Bailly <lubin.bailly@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
{
dgn-hackdays = {
enable = true;
index = 12;
};
}

View file

@ -151,19 +151,6 @@ let
};
};
vlan-hackdays = {
Id = 999;
address = [ "192.168.0.1/22" ];
extraNetwork = {
linkConfig.MTUBytes = 1500;
routes = genList (i: {
Destination = "192.168.${toString (4 * (i + 1))}.0/22";
Gateway = "192.168.0.${toString (i + 2)}";
}) 30;
};
};
vlan-hypervisor = {
Id = 2001;
address = [ "10.0.254.1/24" ];

View file

@ -3,8 +3,7 @@
# SPDX-License-Identifier: EUPL-1.2
{ lib, ... }:
let
inherit (lib) fixedWidthNumber mapAttrs;
inherit (lib.extra) genFuse;
inherit (lib) mapAttrs;
hashedPassword = "$2b$05$3h26h8rJ5yks1vJYXZG.fuHagYBwrVMlGR7iFmsV1FTJlMUj97fl2";
mkSwitch =
@ -34,38 +33,29 @@ let
};
in
{
nodes = mapAttrs (_: mkSwitch) (
{
netcore01 = {
site = "pot01";
ip = "fd26:baf9:d250:8000::1010";
entry = "root@vault01.hyp01.infra.dgnum.eu";
};
nodes = mapAttrs (_: mkSwitch) {
netcore01 = {
site = "pot01";
ip = "fd26:baf9:d250:8000::1010";
entry = "root@vault01.hyp01.infra.dgnum.eu";
};
netcore02 = {
site = "pot01";
ip = "fd26:baf9:d250:8000::100f";
entry = "root@vault01.hyp01.infra.dgnum.eu";
};
netcore02 = {
site = "pot01";
ip = "fd26:baf9:d250:8000::100f";
entry = "root@vault01.hyp01.infra.dgnum.eu";
};
Jaccess01 = {
site = "hyp01";
ip = "fd26:baf9:d250:8000::1001";
entry = "root@vault01.hyp01.infra.dgnum.eu";
};
Jaccess01 = {
site = "hyp01";
ip = "fd26:baf9:d250:8000::1001";
entry = "root@vault01.hyp01.infra.dgnum.eu";
};
Jaccess04 = {
site = "hyp02";
ip = "fd26:baf9:d250:8000::2001";
entry = "root@vault01.hyp01.infra.dgnum.eu";
};
}
// genFuse (i: {
"swHackdays${fixedWidthNumber 2 (i + 1)}" = {
site = "none";
ip = "192.168.0.${toString (i + 2)}";
entry = "root@vault01.hyp01.infra.dgnum.eu";
};
}) 12
);
Jaccess04 = {
site = "hyp02";
ip = "fd26:baf9:d250:8000::2001";
entry = "root@vault01.hyp01.infra.dgnum.eu";
};
};
}

View file

@ -11,6 +11,5 @@
./dgn-access-control.nix
./dgn-profiles.nix
./dgn-isp.nix
./dgn-hackdays.nix
];
}

View file

@ -1,130 +0,0 @@
# SPDX-FileCopyrightText: 2025 Lubin Bailly <lubin.bailly@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
{ lib, config, ... }:
let
inherit (lib)
filter
genList
mapAttrs
mkEnableOption
mkOption
mkIf
optional
optionals
;
inherit (lib.types)
ints
;
cfg = config.dgn-hackdays;
idxInfo = idx: rec {
prefix24 = idx * 4;
next-hop = "192.168.0.${toString (1 + idx)}";
destination = "192.168.${toString prefix24}.0/22";
internal = "192.168.${toString prefix24}.1";
};
inherit (idxInfo cfg.index)
prefix24
next-hop
destination
internal
;
dhcpRange = {
low = "192.168.${toString prefix24}.2";
high = "192.168.${toString (prefix24 + 3)}.250";
};
in
{
options.dgn-hackdays = {
enable = mkEnableOption "hackdays configuration";
portConfig = mkEnableOption "default port configuration for hackdays switches" // {
default = true;
};
index = mkOption {
type = ints.between 1 30;
description = ''
Identifier of this switch.
'';
};
};
config = mkIf cfg.enable {
dgn-hardware.model = "EX4100-F-48P";
vlans = {
"hackdays" = {
id = 998;
l3-interface = "irb.1";
};
"uplink" = {
id = 999;
l3-interface = "irb.0";
};
};
dgn-profiles = {
"client" = {
interfaces = optionals cfg.portConfig (genList (i: "ge-0/0/${toString i}") 47);
configuration = {
poe = true;
ethernet-switching = {
interface-mode = "access";
vlans = [ "hackdays" ];
};
};
};
"uplink" = {
interfaces = optional cfg.portConfig "ge-0/0/47";
configuration.ethernet-switching = {
interface-mode = "access";
vlans = [ "uplink" ];
rstp = false;
};
};
};
# dgn-interfaces is oversimplified for irb
interfaces."irb" = {
enable = true;
unit =
mapAttrs
(_: addr: {
family.inet = {
enable = true;
addresses = [ addr ];
};
})
{
"0" = "${next-hop}/22";
"1" = "${internal}/22";
};
};
system.services.dhcp-local-server.group."hackdays".interfaces = [ "irb.1" ];
access.address-assignment.pool."hackdays".family.inet = {
network = destination;
ranges = [ dhcpRange ];
dhcp-attributes = {
maximum-lease-time = 7200;
router = [ internal ];
name-server = [
"1.1.1.1"
"1.0.0.1"
"8.8.8.8"
"8.8.4.4"
];
};
};
routing-options.static.route =
[
{
destination = "0.0.0.0/0";
next-hop = "192.168.0.1";
}
]
++ map (idx: { inherit (idxInfo idx) destination next-hop; }) (
filter (i: i != cfg.index) (genList (i: i + 1) 30)
);
};
}