summaryrefslogtreecommitdiff
path: root/nix/programs/wireguard/default.nix
blob: 3bddc22ee503d68689bdaf0158c3867d3f525955 (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
{ config, pkgs, ... }:

{
  environment.systemPackages = with pkgs; [
    wireguard-tools
  ];

  networking.wg-quick.interfaces = {
    freyanet = {
      address = [ "10.2.0.2/32" "fd:cafe:dead:bee::2/128" "fe80::2/128" ];
      dns = [ "10.2.2.2" ];
      privateKeyFile = config.sops.secrets.freyanetWg.path;

      peers = [{
        publicKey = "x0ykwakpYCvI/pG+nR83lNUyeOE9m54thnX3bvZ+FUk=";
        allowedIPs = [ "10.0.0.0/12" "fd:cafe::/32" ];
        endpoint = "freya.cat:41111";
        persistentKeepalive = 25;
      }];
    };

    tinternet = {
      address = [ "69.0.0.2/32" "cafe::2/128" "fe80::2/128" ];
      dns = [ "1.1.1.1" ];
      privateKeyFile = config.sops.secrets.tinternetWg.path;

      peers = [{
        publicKey = "8Ice49Yc7N75OYJW59ohDbfUjgrkwIuGWKWocJQGgzI=";
        allowedIPs = [ "0.0.0.0/0" "::/0" ];
        endpoint = "freya.cat:51282";
        persistentKeepalive = 25;
      }];
    };
  };
}