summaryrefslogtreecommitdiff
path: root/os/vms/microvms.nix
diff options
context:
space:
mode:
Diffstat (limited to 'os/vms/microvms.nix')
-rw-r--r--os/vms/microvms.nix40
1 files changed, 40 insertions, 0 deletions
diff --git a/os/vms/microvms.nix b/os/vms/microvms.nix
new file mode 100644
index 0000000..0a24c60
--- /dev/null
+++ b/os/vms/microvms.nix
@@ -0,0 +1,40 @@
+{
+ config,
+ lib,
+ inputs,
+ ...
+}:
+let
+ cfg = config.os.vms;
+ sharedSecrets = [
+ {
+ tag = "shared-secrets";
+ proto = "virtiofs";
+ source = "/etc/nixos/secrets";
+ mountPoint = "/etc/nixos/secrets";
+ }
+ ];
+in
+{
+ imports = [ inputs.microvm.nixosModules.host ];
+
+ options.os.vms = {
+ net-core.enable = lib.mkEnableOption "enables the net-core virtual machine";
+ };
+
+ config = lib.mkMerge [
+ (lib.mkIf cfg.enable {
+ })
+
+ (lib.mkIf cfg.net-core.enable {
+ microvm.vms.net-core = {
+ autostart = true;
+ config = {
+ imports = [ ../vms/net-core.nix ];
+ microvm.shares = sharedSecrets;
+ };
+ };
+ })
+
+ ];
+}