nixos/mullvad-vpn: add the package option

This commit is contained in:
Patrick Jackson 2022-10-27 11:44:35 -07:00 committed by Cole Helbling
parent 86e5f363bc
commit 3aa131978d

View File

@ -4,13 +4,24 @@ let
in
with lib;
{
options.services.mullvad-vpn.enable = mkOption {
type = types.bool;
default = false;
description = lib.mdDoc ''
This option enables Mullvad VPN daemon.
This sets {option}`networking.firewall.checkReversePath` to "loose", which might be undesirable for security.
'';
options.services.mullvad-vpn = {
enable = mkOption {
type = types.bool;
default = false;
description = lib.mdDoc ''
This option enables Mullvad VPN daemon.
This sets {option}`networking.firewall.checkReversePath` to "loose", which might be undesirable for security.
'';
};
package = mkOption {
type = types.package;
default = pkgs.mullvad;
defaultText = literalExpression "pkgs.mullvad";
description = lib.mdDoc ''
The Mullvad package to use. `pkgs.mullvad` only provides the CLI tool, `pkgs.mullvad-vpn` provides both the CLI and the GUI.
'';
};
};
config = mkIf cfg.enable {
@ -39,7 +50,7 @@ with lib;
startLimitBurst = 5;
startLimitIntervalSec = 20;
serviceConfig = {
ExecStart = "${pkgs.mullvad}/bin/mullvad-daemon -v --disable-stdout-timestamps";
ExecStart = "${cfg.package}/bin/mullvad-daemon -v --disable-stdout-timestamps";
Restart = "always";
RestartSec = 1;
};