
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:
nix-build ci -A fmt.check
This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).
This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).
Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase
).
If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
80 lines
2.0 KiB
Nix
80 lines
2.0 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 = ''
|
|
This option enables Mullvad VPN daemon.
|
|
'';
|
|
};
|
|
|
|
enableExcludeWrapper = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = ''
|
|
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 ];
|
|
|
|
# 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"
|
|
];
|
|
# See https://github.com/NixOS/nixpkgs/issues/262681
|
|
path = 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
|
|
];
|
|
}
|