vpn: allow disabling vpn config
This commit is contained in:
parent
10380a53b5
commit
2dd9bea706
|
@ -116,6 +116,7 @@
|
|||
inherit system specialArgs;
|
||||
modules = [
|
||||
./hosts/rainbow.nix
|
||||
{ vpn.enable = true; }
|
||||
./system/rainbow-gitlab-runner.nix
|
||||
] ++ common_modules;
|
||||
};
|
||||
|
|
|
@ -1,4 +1,13 @@
|
|||
{ pkgs, ... }: {
|
||||
{ pkgs, lib, config, ... }:
|
||||
let
|
||||
cfg = config.services.vpn;
|
||||
in
|
||||
{
|
||||
options.services.vpn = {
|
||||
enable = lib.mkEnableOption "Whether vpn should be enabled";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
networking.firewall.enable = false;
|
||||
|
||||
services.mullvad-vpn.enable = true;
|
||||
|
@ -80,4 +89,5 @@
|
|||
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, pkgs, lib, font, ... }:
|
||||
{ config, osConfig, pkgs, lib, font, ... }:
|
||||
let
|
||||
inherit (pkgs.uservars) key theme accent font;
|
||||
inherit (theme) color;
|
||||
|
@ -13,14 +13,14 @@ in
|
|||
layer = "top";
|
||||
modules-left = [ "sway/workspaces" "sway/mode" "sway/window" ];
|
||||
modules-center = [ "clock" ];
|
||||
modules-right = [
|
||||
modules-right = lib.flatten [
|
||||
"sway/language"
|
||||
"mpd"
|
||||
"custom/playerctl"
|
||||
"tray"
|
||||
"custom/caffeine"
|
||||
"pulseaudio"
|
||||
"custom/vpn"
|
||||
(lib.optional osConfig.services.vpn.enable "custom/vpn")
|
||||
"network"
|
||||
"battery"
|
||||
];
|
||||
|
@ -110,7 +110,7 @@ in
|
|||
interval = 1;
|
||||
tooltip = false;
|
||||
};
|
||||
"custom/vpn" = {
|
||||
"custom/vpn" = lib.mkIf osConfig.services.vpn.enable {
|
||||
format = "{}";
|
||||
exec = ''
|
||||
mullvad status | grep "^Connected" > /dev/null \
|
||||
|
|
Loading…
Reference in a new issue