{ self, config, modulesPath, pkgs, lib, ... }: let inherit (lib.lists) optionals; inherit (lib.modules) mkForce; system = pkgs.system; container-ips = import "${self}/data/serverIPs.nix"; hostName = config.networking.hostName; serverIPs = container-ips.${hostName}; gateway = "172.31.1.1"; netmask = "255.255.255.255"; in { imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; systemd.services = { systemd-networkd-wait-online.enable = mkForce false; }; networking = { usePredictableInterfaceNames = false; dhcpcd.enable = false; }; boot.kernelParams = [ "console=tty0" "ip=${serverIPs.ipv4}::${gateway}:${netmask}:${hostName}:eth0:any" ] ++ (lib.optionals (system == "aarch64-linux") ["console=ttyAMA0,115200" "console=ttyS0,115200"]); 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"; } ]; }; }; }