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