niksos/hosts/niks/mullvad/default.nix
2023-07-20 17:03:27 +02:00

23 lines
653 B
Nix

{
config,
pkgs,
...
}: {
environment.systemPackages = with pkgs; [ mullvad-vpn mullvad ];
networking.wireguard.enable = true;
networking.iproute2.enable = true;
services.mullvad-vpn = {
enable = true;
};
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
'';
}