From 8165007ed490978c4452e4a0ce79ee8f873d612c Mon Sep 17 00:00:00 2001 From: Victor Mignot Date: Thu, 9 Jan 2025 12:24:44 +0100 Subject: [PATCH] workstations: Add mullvad-vpn --- configurations/fuyuki/default.nix | 2 ++ configurations/london/default.nix | 2 ++ modules/workstation/default.nix | 1 + modules/workstation/vpn.nix | 24 ++++++++++++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 modules/workstation/vpn.nix diff --git a/configurations/fuyuki/default.nix b/configurations/fuyuki/default.nix index 6c3c764..592ef0c 100644 --- a/configurations/fuyuki/default.nix +++ b/configurations/fuyuki/default.nix @@ -18,6 +18,8 @@ wg0Private.file = ../../secrets/fuyuki-wg0.age; }; + my.connection.vpn.enable = true; + my.users = { dala = { description = "Dala"; diff --git a/configurations/london/default.nix b/configurations/london/default.nix index f9c2953..2492749 100644 --- a/configurations/london/default.nix +++ b/configurations/london/default.nix @@ -54,6 +54,8 @@ ]; }; + my.connection.vpn.enable = true; + # User config my.users = { dala = { diff --git a/modules/workstation/default.nix b/modules/workstation/default.nix index 052af9b..c22fe4a 100644 --- a/modules/workstation/default.nix +++ b/modules/workstation/default.nix @@ -14,6 +14,7 @@ ./bluetooth.nix ./wireshark.nix ./ssh.nix + ./vpn.nix ]; config = diff --git a/modules/workstation/vpn.nix b/modules/workstation/vpn.nix new file mode 100644 index 0000000..3177cdf --- /dev/null +++ b/modules/workstation/vpn.nix @@ -0,0 +1,24 @@ +{ + pkgs, + lib, + config, + ... +}: +let + vpnConfigEnable = config.my.connection.vpn.enable; +in +with lib; +{ + options.my.connection.vpn.enable = mkOption { + type = types.bool; + default = false; + description = "Enable the Mullvad VPN stack."; + }; + + config = mkIf vpnConfigEnable { + services.mullvad-vpn = { + enable = true; + package = pkgs.mullvad-vpn; + }; + }; +}