[microvm] add microvm deployment option to host
This commit is contained in:
@@ -13,6 +13,14 @@ in
|
|||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = lib.mdDoc "Setup bridge device for microvms.";
|
description = lib.mdDoc "Setup bridge device for microvms.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
deployHosts = mkOption {
|
||||||
|
default = [];
|
||||||
|
type = types.listOf string;
|
||||||
|
description = ''
|
||||||
|
List hostnames of MicroVMs that should be automatically initializes and autostart
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -48,5 +56,24 @@ in
|
|||||||
networkConfig.Bridge = "microvm";
|
networkConfig.Bridge = "microvm";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
imports = mkIf cfg.deployHosts != [] [
|
||||||
|
inputs.microvm.nixosModules.host
|
||||||
|
];
|
||||||
|
|
||||||
|
microvm.autostart = cfg.deployHosts;
|
||||||
|
microvm.vms =
|
||||||
|
let
|
||||||
|
# Map the values to each hostname to then generate a Attrs using listToAttrs
|
||||||
|
mapperFunc = name: { inherit name; value = {
|
||||||
|
# Host build-time reference to where the MicroVM NixOS is defined
|
||||||
|
# under nixosConfigurations
|
||||||
|
flake = self;
|
||||||
|
# Specify from where to let `microvm -u` update later on
|
||||||
|
updateFlake = "git+https://git.dynamicdiscord.de/kalipso/infrastructure?ref=microvm";
|
||||||
|
}; };
|
||||||
|
in
|
||||||
|
mkIf cfg.deployHosts != []
|
||||||
|
builtins.listToAttrs (map mapperFunc cfg.deployHosts);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user