fix: use networkd for all kubevirt guest

This commit is contained in:
Ryan Yin
2024-04-01 00:45:40 +08:00
parent c628eaa6c8
commit 2047104704
+17 -6
View File
@@ -4,7 +4,9 @@
networking, networking,
... ...
}: let }: let
inherit (networking.hostsAddr.${hostName}) iface; inherit (networking) mainGateway nameservers;
inherit (networking.hostsAddr.${hostName}) iface ipv4;
ipv4WithMask = "${ipv4}/24";
in { in {
# supported file systems, so we can mount any removable disks with these filesystems # supported file systems, so we can mount any removable disks with these filesystems
boot.supportedFilesystems = [ boot.supportedFilesystems = [
@@ -16,11 +18,20 @@ in {
"exfat" "exfat"
]; ];
networking = { networking = {inherit hostName;};
inherit hostName; networking.useNetworkd = true;
inherit (networking) defaultGateway nameservers; systemd.network.enable = true;
inherit (networking.hostsInterface.${hostName}) interfaces;
networkmanager.enable = false; # Add ipv4 address to the bridge.
systemd.network.networks."10-${iface}" = {
matchConfig.Name = [iface];
networkConfig = {
Address = [ipv4WithMask];
Gateway = mainGateway;
DNS = nameservers;
IPv6AcceptRA = true;
};
linkConfig.RequiredForOnline = "routable";
}; };
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default