blob: fb6fd3a1dc64143e7118a97f15e3534e05ae4181 (
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
|
{ config, lib, pkgs, ... }:
let
cfg = config.orbekk.vpn;
in
{
options = {
orbekk.vpn = {
enable = lib.mkEnableOption "Enable VPN";
listenPort = lib.mkOption {
type = lib.types.port;
default = 40421;
description = "wireguard local port";
};
};
};
config = lib.mkIf cfg.enable {
orbekk.simple-firewall.allowedUDPPorts = [ cfg.listenPort ];
networking.wireguard = {
enable = true;
interfaces.vpn = {
privateKeyFile = "/opt/secret/wireguard/vpn.private";
ips = [ "10.70.90.245/32" "fc00:bbbb:bbbb:bb01::7:5af4/128" ];
allowedIPsAsRoutes = false;
listenPort = cfg.listenPort;
peers = [
];
};
};
};
}
|