summaryrefslogtreecommitdiff
path: root/microvms/nextcloud/oxaproxy.nix
blob: 42290acc142d381785edee1f2c9357e5aae4aa92 (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
57
58
{ config, ... }: {
  networking.wireguard.enable = true;
  networking.useNetworkd = true;
  systemd.network = {
    enable = true;
    netdevs."10-oxaproxy" = {
      netdevConfig = {
        Kind = "wireguard";
        Name = "oxaproxy";
        Description = "oxa's enterprise reverse-proxy network";
      };
      wireguardConfig = {
        PrivateKeyFile = config.sops.secrets."wg/oxaproxy-seckey".path;
        #own pubkey: KCYoGx7TGei4X79EZo2NONCcmQjPzBUN1Ds6I9lQbz0=
        };
        wireguardPeers = [
          {
          # cirrus
          wireguardPeerConfig = {
            PublicKey = "0KMtL2fQOrrCH6c2a2l4FKiM73G86sUuyaNj4FarzVM=";
            AllowedIPs = [ "10.34.45.0/24" ];
            Endpoint = [ "95.216.166.21:51821" ];
            PersistentKeepalive = 25;
          };
        }
      ];
    };
    networks."10-oxaproxy" = {
      matchConfig.Name = "oxaproxy";
      networkConfig = {
        Address = "10.34.45.100/24";
      };
    };

    networks."111-host" = {
      matchConfig.Name = "enp0s8";
      networkConfig = {
        Address = "10.99.99.100/24";
      };
      routes = [
        {
          routeConfig = {
            Gateway="10.99.99.1";
            Destination="0.0.0.0/0";
            Metric=1024;
          };
        }
        {
          routeConfig = {
            Gateway="10.99.99.1";
            Destination="10.99.99.0/24";
            Metric=1024;
          };
        }
      ];
    };
  };
}