nixos/mullvad-vpn: add service
mullvad-vpn package is mostly useless without it.
This commit is contained in:
parent
383556b5e7
commit
89f5dc24ed
|
@ -636,6 +636,7 @@
|
||||||
./services/networking/miredo.nix
|
./services/networking/miredo.nix
|
||||||
./services/networking/mstpd.nix
|
./services/networking/mstpd.nix
|
||||||
./services/networking/mtprotoproxy.nix
|
./services/networking/mtprotoproxy.nix
|
||||||
|
./services/networking/mullvad-vpn.nix
|
||||||
./services/networking/murmur.nix
|
./services/networking/murmur.nix
|
||||||
./services/networking/mxisd.nix
|
./services/networking/mxisd.nix
|
||||||
./services/networking/namecoind.nix
|
./services/networking/namecoind.nix
|
||||||
|
|
43
nixos/modules/services/networking/mullvad-vpn.nix
Normal file
43
nixos/modules/services/networking/mullvad-vpn.nix
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
{ 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 ];
|
||||||
|
}
|
Loading…
Reference in a new issue