summaryrefslogtreecommitdiff
path: root/nixos/modules/features/vpn-utils/default.nix
blob: 89b92e4f8ab55587fd73a058f3d0e0d860764ca9 (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
{ pkgs, ... }:

{
  programs.throne = {
    enable = true;
    tunMode.enable = true;
  };

  programs.amnezia-vpn.enable = true;

  networking.wireguard.enable = true;

  boot.kernelModules = [ "wireguard" ];

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

  systemd.services.wireguard-client = {
    description = "WireGuard client tunnel (wg)";
    after = [ "network-online.target" ];
    wants = [ "network-online.target" ];
    wantedBy = [ "multi-user.target" ];
    serviceConfig = {
      Type = "oneshot";
      RemainAfterExit = true;
      ExecStart = "${pkgs.wireguard-tools}/bin/wg-quick up wg";
      ExecStop = "${pkgs.wireguard-tools}/bin/wg-quick down wg";
    };
  };
}