mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-15 02:03:01 +00:00
6c5ab28fce
This was done by generating a truly hilarious configuration: rg 'services\.[^.]+\.enable\t' opts-tags | cut -f1 > allonconfig.nix The following were not tested due to other evaluation errors. They should probably be manually audited. services.amule services.castopod services.ceph services.chatgpt-retrieval-plugin services.clamsmtp services.clight services.dante services.dex services.discourse services.dwm-status services.engelsystem services.foundationdb services.frigate services.frp services.grocy services.guacamole-client services.hedgedoc services.home-assistant services.honk services.imaginary services.jitsi-meet services.kerberos_server services.limesurvey services.mastodon services.mediawiki services.mobilizon services.moodle services.mosquitto services.nextcloud services.nullmailer services.patroni services.pfix-srsd services.pgpkeyserver-lite services.postfixadmin services.roundcube services.schleuder services.self-deploy services.slskd services.spacecookie services.statsd services.step-ca services.sympa services.tsmBackup services.vdirsyncer services.vikunja services.yandex-disk services.zabbixWeb
81 lines
2.3 KiB
Nix
81 lines
2.3 KiB
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 = lib.mdDoc ''
|
|
This option enables Mullvad VPN daemon.
|
|
This sets {option}`networking.firewall.checkReversePath` to "loose", which might be undesirable for security.
|
|
'';
|
|
};
|
|
|
|
enableExcludeWrapper = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = lib.mdDoc ''
|
|
This option activates the wrapper that allows the use of mullvad-exclude.
|
|
Might have minor security impact, so consider disabling if you do not use the feature.
|
|
'';
|
|
};
|
|
|
|
package = mkPackageOption pkgs "mullvad" {
|
|
example = "mullvad-vpn";
|
|
extraDescription = ''
|
|
`pkgs.mullvad` only provides the CLI tool, `pkgs.mullvad-vpn` provides both the CLI and the GUI.
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
boot.kernelModules = [ "tun" ];
|
|
|
|
environment.systemPackages = [ cfg.package ];
|
|
|
|
# mullvad-daemon writes to /etc/iproute2/rt_tables
|
|
networking.iproute2.enable = true;
|
|
|
|
# See https://github.com/NixOS/nixpkgs/issues/113589
|
|
networking.firewall.checkReversePath = "loose";
|
|
|
|
# See https://github.com/NixOS/nixpkgs/issues/176603
|
|
security.wrappers.mullvad-exclude = mkIf cfg.enableExcludeWrapper {
|
|
setuid = true;
|
|
owner = "root";
|
|
group = "root";
|
|
source = "${cfg.package}/bin/mullvad-exclude";
|
|
};
|
|
|
|
systemd.services.mullvad-daemon = {
|
|
description = "Mullvad VPN daemon";
|
|
wantedBy = [ "multi-user.target" ];
|
|
wants = [ "network.target" "network-online.target" ];
|
|
after = [
|
|
"network-online.target"
|
|
"NetworkManager.service"
|
|
"systemd-resolved.service"
|
|
];
|
|
path = [
|
|
pkgs.iproute2
|
|
# Needed for ping
|
|
"/run/wrappers"
|
|
# See https://github.com/NixOS/nixpkgs/issues/262681
|
|
] ++ (lib.optional config.networking.resolvconf.enable
|
|
config.networking.resolvconf.package);
|
|
startLimitBurst = 5;
|
|
startLimitIntervalSec = 20;
|
|
serviceConfig = {
|
|
ExecStart = "${cfg.package}/bin/mullvad-daemon -v --disable-stdout-timestamps";
|
|
Restart = "always";
|
|
RestartSec = 1;
|
|
};
|
|
};
|
|
};
|
|
|
|
meta.maintainers = with maintainers; [ arcuru ymarkus ];
|
|
}
|