2024-06-22 10:58:39 -04:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
inputs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
cfg = config.rad-dev.microvm-host;
|
|
|
|
microvm = inputs.microvm.nixosModules;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
imports = [ microvm.host ];
|
|
|
|
options.rad-dev.microvm-host = {
|
|
|
|
vms = lib.mkOption {
|
2024-05-25 15:19:01 -04:00
|
|
|
type = lib.types.attrs;
|
2024-06-22 10:58:39 -04:00
|
|
|
default = { };
|
|
|
|
description = "A list of VMs to construct on the host";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
config = {
|
|
|
|
networking.useNetworkd = true;
|
|
|
|
microvm.vms = cfg.vms;
|
|
|
|
|
|
|
|
# TODO: deprecate this once we have syslog forwarders
|
2024-05-25 18:29:34 -04:00
|
|
|
systemd.tmpfiles.rules = map (
|
|
|
|
vmHost:
|
|
|
|
let
|
|
|
|
machineId = cfg.vms.${vmHost}.config.environment.etc."machine-id".text;
|
|
|
|
in
|
|
|
|
# creates a symlink of each MicroVM's journal under the host's /var/log/journal
|
|
|
|
"L+ /var/log/journal/${machineId} - - - - /var/lib/microvms/${vmHost}/journal/${machineId}"
|
|
|
|
) (builtins.attrNames cfg.vms);
|
2024-06-22 10:58:39 -04:00
|
|
|
};
|
|
|
|
}
|