2024-12-12 14:41:43 +01:00
|
|
|
# SPDX-FileCopyrightText: 2024 Ryan Lahfa <ryan.lahfa@dgnum.eu>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: EUPL-1.2
|
|
|
|
|
2024-12-07 16:20:53 +01:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
modulesPath,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
svc = config.system.service;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
defaultProfile.packages = with pkgs; [
|
|
|
|
# Levitate enable us to mass-reinstall the system on the fly.
|
|
|
|
(levitate.override {
|
|
|
|
config = {
|
|
|
|
imports = [
|
|
|
|
"${modulesPath}/network"
|
|
|
|
"${modulesPath}/ssh"
|
|
|
|
"${modulesPath}/hardware.nix"
|
|
|
|
"${modulesPath}/kernel"
|
|
|
|
"${modulesPath}/outputs/tftpboot.nix"
|
|
|
|
"${modulesPath}/outputs.nix"
|
|
|
|
];
|
|
|
|
nixpkgs.buildPlatform = builtins.currentSystem;
|
|
|
|
services = {
|
|
|
|
# In this situation, we fallback to the appro VLAN.
|
|
|
|
# TODO: add support for the admin VLAN.
|
|
|
|
# Simplest DHCPv4 we can find.
|
|
|
|
dhcpv4 = svc.network.dhcp.client.build {
|
|
|
|
interface = config.hardware.networkInterfaces.lan;
|
|
|
|
};
|
|
|
|
inherit (config.services) sshd;
|
|
|
|
defaultroute4 = svc.network.route.build {
|
|
|
|
via = "$(output ${config.services.dhcpv4} router)";
|
|
|
|
target = "default";
|
|
|
|
dependencies = [ config.services.dhcpv4 ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
defaultProfile.packages = [ mtdutils ];
|
|
|
|
# Only keep root, which should inherit from DGN access control's root permissions.
|
|
|
|
users.root = config.users.root;
|
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
|
|
|
}
|