44 lines
858 B
Nix
44 lines
858 B
Nix
{
|
|
lib,
|
|
pkgs,
|
|
addressList,
|
|
...
|
|
}: let
|
|
genVMConfig = {
|
|
name,
|
|
config ? {},
|
|
ro-store ? true,
|
|
}: {
|
|
restartIfChanged = true;
|
|
inherit pkgs;
|
|
config =
|
|
config
|
|
// {
|
|
microvm = {
|
|
shares = lib.mkIf ro-store [
|
|
{
|
|
source = "/nix/store";
|
|
mountPoint = "/nix/.ro-store";
|
|
tag = "ro-store";
|
|
proto = "virtiofs";
|
|
}
|
|
];
|
|
interfaces = [
|
|
{
|
|
type = "tap";
|
|
id = name;
|
|
inherit (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;};
|
|
};
|
|
};
|
|
}
|