summaryrefslogtreecommitdiff
path: root/os/vms/microvms.nix
blob: 0a24c606d9fc121380b1c138bd02ab1442b975aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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;
        };
      };
    })

  ];
}