aboutsummaryrefslogtreecommitdiff
path: root/tardis-new/modules/common.nix
blob: 0d6a1ba050fbfe26ad3e1f4fd77416b7db364e07 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{
  lib,
  config,
  ...
}: {
  networking.domain = lib.consts.mainDomain;

  system.stateVersion = "23.05";

  # Share NixOS store for efficiency
  microvm = {
    storeOnDisk = false;
    shares = [
      {
        tag = "ro-store";
        source = "/nix/store";
        mountPoint = "/nix/.ro-store";
      }
    ];
  };

  microvm = {
    # Hypervisor setup
    hypervisor = "qemu";
    socket = "control.socket";

    # Trusted bridge setup
    interfaces = [
      {
        type = "tap";
        id = "vm-${config.networking.hostName}";
        mac = "02:00:00:00:00:01";
      }
    ];
  };

  # If this isn't set, then every system changes whenever a commit is made
  # Which is super annoying
  nix.registry = lib.mkForce {};

  # SSH Access
  services.openssh = {
    enable = true;
    openFirewall = true;
    settings.PermitRootLogin = "prohibit-password";
  };
  users.users.root.openssh.authorizedKeys.keys = [lib.consts.rootPubKey];

  # Swap file
  # swapDevices = [
  #   {
  #     device = "/swapfile";
  #     size = builtins.floor (config.microvm.mem * 0.5);
  #   }
  # ];
}