Skip to content

VPN

WireGuard VPN configuration for confining services to a network namespace.

Available Options

This page documents 6 configuration options.

nixflix.vpn.enable

Whether to enable WireGuard VPN.

Typeboolean
Default
false
Example
true
Declared inmodules/vpn.nix

nixflix.vpn.accessibleFrom

List of subnets or addresses in the default network namespace that should be able to reach services confined in the VPN namespace.

Required to access VPN-confined services (e.g. Radarr, Sonarr) from your local network. Example: ["192.168.1.0/24"].

Typelist of string
Default
[
  "192.168.1.0/24"
]
Example
[
  "192.168.1.0/24"
]
Declared inmodules/vpn.nix

nixflix.vpn.openVPNPorts

Ports to open through the VPN interface, e.g. for port forwarding provided by the VPN provider (AirVPN, IVPN, etc.).

Typelist of (submodule)
Default
[ ]
Example
[
  {
    port = 60729;
    protocol = "both";
  }
]
Declared inmodules/vpn.nix

nixflix.vpn.openVPNPorts.*.port

Port number to open through the VPN interface.

Type16 bit unsigned integer; between 0 and 65535 (both inclusive)
Declared inmodules/vpn.nix

nixflix.vpn.openVPNPorts.*.protocol

Protocol for the port.

Typeone of "tcp", "udp", "both"
Default
"tcp"
Declared inmodules/vpn.nix

nixflix.vpn.wgConfFile

Path to a wg-quick compatible WireGuard configuration file.

The file must contain at least [Interface] with Address, PrivateKey, and DNS fields, and one or more [Peer] sections with PublicKey, Endpoint, and AllowedIPs.

This file is read at service startup. Use a path to a file managed by your secrets solution (e.g. agenix, sops-nix) to keep the private key out of the Nix store.

Typeabsolute path
Example
"/etc/wireguard/airvpn.conf"
Declared inmodules/vpn.nix