nixos-servers/nix/virtual.nix
2024-01-28 12:06:30 +01:00

29 lines
624 B
Nix

{ lib, config, machine, hypervisorConfig, ... }: {
imports = [ ./shared.nix ];
options.lab.vmMacAddress = lib.mkOption {
type = lib.types.str;
description = ''
The MAC address of the VM's main NIC.
'';
};
config = {
system.stateVersion = hypervisorConfig.system.stateVersion;
microvm = {
shares = [{
source = "/nix/store";
mountPoint = "/nix/.ro-store";
tag = "ro-store";
proto = "virtiofs";
}];
interfaces = [{
type = "tap";
id = "vm-${machine.hostName}";
mac = config.lab.vmMacAddress;
}];
};
};
}