aboutsummaryrefslogblamecommitdiff
path: root/machines/nixos/x86_64-linux/do-rproxy/default.nix
blob: 877f4c5840bfc52c156aef8db3180553f5a1894e (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
 
         
      
              


     



                                                              
               
                      
                 
                        

    


                                                                    
                                    





                                 





                                                         






                                                                     


      
                                                    
                                                  
 

                                                            
{
  config,
  lib,
  modulesPath,
  ...
}:
{

  imports = [
    (modulesPath + "/profiles/qemu-guest.nix")
    (modulesPath + "/virtualisation/digital-ocean-config.nix")
    ./disks.nix
    ./digitalocean.nix
    ./secrets.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?
}