nixos/mullvad-vpn: add mullvad-exclude wrapper & systemPackage

Changed files
+19
nixos
modules
services
networking
+19
nixos/modules/services/networking/mullvad-vpn.nix
···
'';
};
+
enableExcludeWrapper = mkOption {
+
type = types.bool;
+
default = true;
+
description = lib.mdDoc ''
+
This option activates the wrapper that allows the use of mullvad-exclude.
+
Might have minor security impact, so consider disabling if you do not use the feature.
+
'';
+
};
+
package = mkOption {
type = types.package;
default = pkgs.mullvad;
···
config = mkIf cfg.enable {
boot.kernelModules = [ "tun" ];
+
environment.systemPackages = [ cfg.package ];
+
# mullvad-daemon writes to /etc/iproute2/rt_tables
networking.iproute2.enable = true;
# See https://github.com/NixOS/nixpkgs/issues/113589
networking.firewall.checkReversePath = "loose";
+
+
# See https://github.com/NixOS/nixpkgs/issues/176603
+
security.wrappers.mullvad-exclude = mkIf cfg.enableExcludeWrapper {
+
setuid = true;
+
owner = "root";
+
group = "root";
+
source = "${cfg.package}/bin/mullvad-exclude";
+
};
systemd.services.mullvad-daemon = {
description = "Mullvad VPN daemon";