8ac5e011d6
GitOrigin-RevId: 2c3273caa153ee8eb5786bc8141b85b859e7efd7
43 lines
1,007 B
Nix
43 lines
1,007 B
Nix
{ config, lib, pkgs, ... }:
|
|
let
|
|
cfg = config.services.mullvad-vpn;
|
|
in
|
|
with lib;
|
|
{
|
|
options.services.mullvad-vpn.enable = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = ''
|
|
This option enables Mullvad VPN daemon.
|
|
'';
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
boot.kernelModules = [ "tun" ];
|
|
|
|
systemd.services.mullvad-daemon = {
|
|
description = "Mullvad VPN daemon";
|
|
wantedBy = [ "multi-user.target" ];
|
|
wants = [ "network.target" ];
|
|
after = [
|
|
"network-online.target"
|
|
"NetworkManager.service"
|
|
"systemd-resolved.service"
|
|
];
|
|
path = [
|
|
pkgs.iproute
|
|
# Needed for ping
|
|
"/run/wrappers"
|
|
];
|
|
serviceConfig = {
|
|
StartLimitBurst = 5;
|
|
StartLimitIntervalSec = 20;
|
|
ExecStart = "${pkgs.mullvad-vpn}/bin/mullvad-daemon -v --disable-stdout-timestamps";
|
|
Restart = "always";
|
|
RestartSec = 1;
|
|
};
|
|
};
|
|
};
|
|
|
|
meta.maintainers = [ maintainers.xfix ];
|
|
}
|