more microvm rice

This commit is contained in:
iofq 2024-01-27 19:39:29 -06:00
parent 94ebce046b
commit 6ae9ddb73a
9 changed files with 123 additions and 49 deletions

30
nixos/htz/vms/default.nix Normal file
View file

@ -0,0 +1,30 @@
{ lib, pkgs, addressList, ... }:
let genVMConfig = { name, config ? {}, ro-store ? true }: {
restartIfChanged = true;
pkgs = pkgs;
config = config // {
microvm = {
shares = lib.mkIf (ro-store == true) [{
source = "/nix/store";
mountPoint = "/nix/.ro-store";
tag = "ro-store";
proto = "virtiofs";
}];
interfaces = [
{
type = "tap";
id = name;
mac = addressList.${name}.mac;
}
];
};
} // import ./vmDefaults.nix { inherit name addressList; };
};
in {
microvm.vms = {
vm-test = genVMConfig {
name = "vm-test";
config = import ./vm-test.nix { inherit pkgs addressList; };
};
};
}