Files
nix-config/hosts/12kingdoms-youko/microvm.nix
T
ryan4yin | 二花 de6a66ccd4 fix(microvm): run k3s guests from their nixosConfigurations entry (#483)
Assisted-by: DeepSeek Harness 0.2.1-rc.2 (claude-opus-5-5)
2026-10-21 21:32:56 +08:00

46 lines
1.4 KiB
Nix

{
microvm,
inputs,
...
}:
{
# Run the k3s-test VMs as MicroVMs instead of KubeVirt domains.
imports = [ microvm.nixosModules.host ];
# Each guest runs its `nixosConfigurations` entry, the system that `just test`
# and `just microvm-deploy` see, instead of a second evaluation on the host.
microvm.vms.k3s-test-1-master-2 = {
autostart = true;
restartIfChanged = true;
evaluatedConfig = inputs.self.nixosConfigurations.k3s-test-1-master-2;
};
# Moved here from shushou after the SSD swap: the 5625U there is weaker and has
# only 22 GiB, too little for this 16 GiB worker.
microvm.vms.k3s-test-1-worker-2 = {
autostart = true;
restartIfChanged = true;
evaluatedConfig = inputs.self.nixosConfigurations.k3s-test-1-worker-2;
};
# Attach the guest's tap to the VM bridge, the same way the physical NIC is
# attached. The name is vm<last IP octet> from lib/genMicrovmGuestModule.nix:
# 192.168.5.115 -> vm115, 192.168.5.112 -> vm112.
systemd.network.networks."20-vm115" = {
matchConfig.Name = [ "vm115" ];
networkConfig = {
LinkLocalAddressing = "no";
Bridge = "br0";
};
linkConfig.RequiredForOnline = "no";
};
systemd.network.networks."20-vm112" = {
matchConfig.Name = [ "vm112" ];
networkConfig = {
LinkLocalAddressing = "no";
Bridge = "br0";
};
linkConfig.RequiredForOnline = "no";
};
}