62 lines
1 KiB
Nix
62 lines
1 KiB
Nix
![]() |
{
|
||
|
self,
|
||
|
config,
|
||
|
modulesPath,
|
||
|
lib,
|
||
|
...
|
||
|
}: let
|
||
|
inherit (lib.modules) mkForce;
|
||
|
|
||
|
container-ips = import "${self}/data/serverIPs.nix";
|
||
|
|
||
|
hostName = config.networking.hostName;
|
||
|
serverIPs = container-ips.${hostName};
|
||
|
in {
|
||
|
imports = [
|
||
|
(modulesPath + "/profiles/qemu-guest.nix")
|
||
|
];
|
||
|
|
||
|
systemd.services = {
|
||
|
systemd-networkd-wait-online.enable = mkForce false;
|
||
|
};
|
||
|
|
||
|
networking = {
|
||
|
usePredictableInterfaceNames = false;
|
||
|
dhcpcd.enable = false;
|
||
|
};
|
||
|
|
||
|
systemd.network = {
|
||
|
enable = true;
|
||
|
networks."eth0" = {
|
||
|
name = "eth0";
|
||
|
networkConfig.DHCP = "no";
|
||
|
address = [
|
||
|
# v4
|
||
|
"${serverIPs.ipv4}/32"
|
||
|
|
||
|
# v6
|
||
|
"${serverIPs.ipv6}/64"
|
||
|
];
|
||
|
|
||
|
routes = [
|
||
|
# v4
|
||
|
{
|
||
|
routeConfig = {
|
||
|
Destination = "172.31.1.1";
|
||
|
};
|
||
|
}
|
||
|
{
|
||
|
routeConfig = {
|
||
|
Gateway = "172.31.1.1";
|
||
|
GatewayOnLink = true;
|
||
|
};
|
||
|
}
|
||
|
# v6
|
||
|
{
|
||
|
routeConfig.Gateway = "fe80::1";
|
||
|
}
|
||
|
];
|
||
|
};
|
||
|
};
|
||
|
}
|