aboutsummaryrefslogtreecommitdiff
path: root/machines/nixos/x86_64-linux/do-rproxy/default.nix
blob: eb403964a905579260ff9b8fa216200f1ab3cd94 (plain) (blame)
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
57
58
59
60
61
{
  adminUser,
  config,
  lib,
  modulesPath,
  self,
  ...
}:
{

  imports = [
    (modulesPath + "/profiles/qemu-guest.nix")
    (modulesPath + "/virtualisation/digital-ocean-config.nix")
    ./disks.nix
    ./digitalocean.nix
    ./secrets.nix
    {
      home-manager.users.${adminUser.name} = {
        imports = [
          ./home.nix
          { home.stateVersion = "25.05"; }
        ];
      };
    }
    "${self}/profiles/admin-user/user.nix"
    "${self}/profiles/admin-user/home-manager.nix"
    "${self}/profiles/services/podman.nix"
    ./profiles/nginx.nix
  ];

  # do not use DHCP, as DigitalOcean provisions IPs using cloud-init
  networking.useDHCP = lib.mkForce false;

  networking.hostName = "do-rproxy";

  boot.loader.grub = {
    efiSupport = true;
    efiInstallAsRemovable = true;
  };

  networking.wireguard = {
    enable = true;
    interfaces.wg0 = {
      ips = [ "10.100.0.50/32" ];
      listenPort = 51871;
      privateKeyFile = config.age.secrets.wireguard.path;
      peers = [
        {
          publicKey = "bJZyQoemudGJQox8Iegebm23c4BNVIxRPy1kmI2l904=";
          allowedIPs = [ "10.100.0.0/24" ];
          persistentKeepalive = 25;
        }
      ];
    };
  };

  networking.firewall.trustedInterfaces = [ "wg0" ];
  networking.firewall.allowedUDPPorts = [ 51871 ];

  system.stateVersion = "25.05"; # Did you read the comment?
}