{lib,config,...}:letenable=true;inlib.mkIfenable{age.secrets.mullvad.file=../../secrets/mullvad.age;services.mullvad-vpn.enable=true;systemd.services.mullvad-provision={description="Log in to Mullvad and keep it connected";wantedBy=["multi-user.target"];after=["mullvad-daemon.service"];requires=["mullvad-daemon.service"];path=[config.services.mullvad-vpn.package];serviceConfig={Type="oneshot";RemainAfterExit=true;};script=''
until mullvad status >/dev/null 2>&1; do sleep 1; done
mullvad account login "$(cat ${config.age.secrets.mullvad.path})"
mullvad auto-connect set on
mullvad connect
'';};}