1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-01 14:41:03 +01:00

mullvad-vpn: add module

This commit is contained in:
awwpotato 2025-08-06 21:18:47 -07:00 committed by Austin Horstman
parent 6275d1fc57
commit c7acf2b1bf
3 changed files with 100 additions and 0 deletions

View file

@ -0,0 +1,52 @@
{
lib,
pkgs,
config,
...
}:
let
cfg = config.programs.mullvad-vpn;
jsonFormat = pkgs.formats.json { };
in
{
meta.maintainers = [ lib.maintainers.awwpotato ];
options.programs.mullvad-vpn = {
enable = lib.mkEnableOption "Mullvad VPN";
package = lib.mkPackageOption pkgs "mullvad-vpn" { nullable = true; };
settings = lib.mkOption {
inherit (jsonFormat) type;
default = { };
description = ''
Written to {file}`XDG_CONFIG_HOME/Mullvad VPN/gui_settings.json` or
{file}`~/Library/Application Support/Mullvad VPN/gui_settings.json`.
See <https://github.com/mullvad/mullvadvpn-app/blob/main/desktop/packages/mullvad-vpn/src/main/gui-settings.ts>
for options.
'';
example = {
preferredLocale = "system";
autoConnect = false;
enableSystemNotifications = true;
monochromaticIcon = false;
startMinimized = false;
unpinnedWindow = true;
browsedForSplitTunnelingApplications = [ ];
changelogDisplayedForVersion = "";
updateDismissedForVersion = "";
animateMap = true;
};
};
};
config = lib.mkIf cfg.enable {
home.package = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file."${
if pkgs.stdenv.hostPlatform.isDarwin then "Library/Application Support" else config.xdg.configHome
}/Mullvad VPN/gui_settings.json" =
lib.mkIf (cfg.settings != { }) {
source = jsonFormat.generate "mullvad-gui-settings" cfg.settings;
};
};
}