nixos-servers/nixos/virtual.nix

27 lines
594 B
Nix

{ lib, config, hypervisorConfig, ... }: {
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-${config.networking.hostName}";
mac = config.lab.vmMacAddress;
}];
};
};
}