niksos/hosts/niks/mullvad/default.nix
2023-07-30 00:52:01 +02:00

24 lines
689 B
Nix

{
config,
pkgs,
...
}: {
environment.systemPackages = with pkgs; [ mullvad-vpn mullvad ];
networking.wireguard.enable = true;
networking.iproute2.enable = true;
services.mullvad-vpn = {
enable = true;
package = pkgs.mullvad-vpn;
};
systemd.services."mullvad-daemon".postStart = let
mullvad = config.services.mullvad-vpn.package;
in ''
while ! ${mullvad}/bin/mullvad status > /dev/null; do sleep 1; done
${mullvad}/bin/mullvad auto-connect set on
${mullvad}/bin/mullvad tunnel ipv6 set on
${mullvad}/bin/mullvad set default --block-ads --block-trackers --block-malware
'';
}