Compare commits

...
7 Commits
4 changed files with 82 additions and 39 deletions

No files matched your search

Generated
+12 -12
View File
@@ -60,11 +60,11 @@
]
},
"locked": {
"lastModified": 1793797582,
"narHash": "sha256-jEdYjdicxnCdlD4A7+s+iKPc2N0NSWzCHyPkHC5sXow=",
"lastModified": 1794556356,
"narHash": "sha256-ac6+sxINJCWCU+/tTN1tSs71Es56Kpk6t6V1csMe5hk=",
"ref": "main",
"rev": "81d87991086b96a185834702efced1e7a9b29b2f",
"revCount": 25,
"rev": "e801dde50339438f720db62bda1a45fa51861e47",
"revCount": 27,
"type": "git",
"url": "ssh://gitea@git.ppp.pm:1122/alex/ct.git"
},
@@ -81,11 +81,11 @@
]
},
"locked": {
"lastModified": 1794228227,
"narHash": "sha256-PBSsjv/YspImKvqukcjk5EPCFNM4JGwgg6QBlNXZNdg=",
"lastModified": 1794561158,
"narHash": "sha256-1aeTxyWnFq9Vn+caG6blg2MrqN+cb8TA6Fwtj+z6Jwo=",
"ref": "main",
"rev": "67e8044772f6e00abe179a0dc0b0a85554b842a7",
"revCount": 45,
"rev": "b07a67b94056da3be29ed4dd7e146bc6cfe6c15d",
"revCount": 48,
"type": "git",
"url": "ssh://gitea@git.ppp.pm:1122/alex/dagbok.git"
},
@@ -711,11 +711,11 @@
]
},
"locked": {
"lastModified": 1794225659,
"narHash": "sha256-dr9VmlZa9Cwd7EbKFaYxjch4Px4AG0O6tv9a2dJusLo=",
"lastModified": 1794560880,
"narHash": "sha256-HszelndbRC0mlXyW6xZf3NXySj2CoehqoDq4P6QYlQ8=",
"ref": "main",
"rev": "a62467743b50203188a079c9e3267ff676478877",
"revCount": 12,
"rev": "3684df521a4af58856cd81e1ad63cfe034c492f6",
"revCount": 19,
"type": "git",
"url": "ssh://gitea@git.ppp.pm:1122/alex/ndp.git"
},
+1 -1
View File
@@ -718,7 +718,7 @@ Setup prefix for keybindings.
** Dagbok
#+BEGIN_SRC emacs-lisp
(use-package dagbok
:commands (dagbok-today dagbok-open-date dagbok-next-day dagbok-previous-day
:commands (dagbok-today dagbok-year dagbok-next-day dagbok-previous-day
dagbok-switch-journal dagbok-note dagbok-tasks dagbok-search
dagbok-add-task dagbok-set-status dagbok-toggle-flag
dagbok-toggle-highlight dagbok-reload dagbok-browse)
+39 -24
View File
@@ -87,26 +87,33 @@ let
esac
'';
work-vpn-status = pkgs.writeShellScript "work-vpn-status" ''
ACTIVE_ENVS=""
work-vpn = pkgs.writeShellScript "work-vpn" ''
connected() {
systemctl is-active --quiet openvpn-work-staging.service openvpn-work-production.service
}
STAGING_STATUS=$(systemctl is-active openvpn-work-staging.service)
if [ "$STAGING_STATUS" == "active" ]; then
ACTIVE_ENVS="S"
fi
output() {
if connected; then
echo '{ "text": "WORK-VPN ON", "class": "connected" }'
else
echo "{ \"text\": \"<span font='16' rise='-3000'>󰖂</span>\", \"tooltip\": \"Work VPN off\", \"class\": \"disconnected\" }"
fi
}
PRODUCTION_STATUS=$(systemctl is-active openvpn-work-production.service)
if [ "$PRODUCTION_STATUS" == "active" ]; then
if [ -n "$ACTIVE_ENVS" ]; then
ACTIVE_ENVS="$ACTIVE_ENVS&amp;P"
else
ACTIVE_ENVS="P"
fi
fi
toggle() {
if connected; then
systemctl stop work-vpn.target && ${pkgs.libnotify}/bin/notify-send "Disconnected from work VPN"
else
systemctl start work-vpn.target && ${pkgs.libnotify}/bin/notify-send "Connected to work VPN"
fi
}
if [ -n "$ACTIVE_ENVS" ]; then
echo "WORK-VPN $ACTIVE_ENVS ON"
fi
case $1 in
--toggle)
toggle ;;
--output)
output ;;
esac
'';
toggle-bt-power = pkgs.writeShellScript "toggle-bt-power" ''
@@ -142,20 +149,22 @@ in
modules-left = lib.mkIf hyprlandEnabled [ "hyprland/workspaces" ];
modules-right = [
"custom/work-vpn-status"
"custom/music"
"custom/container-status"
"custom/dunst"
"bluetooth"
"wireplumber"
"custom/work-vpn"
"custom/tailscale"
"network"
"battery"
"clock"
];
"custom/work-vpn-status" = {
exec = "${work-vpn-status}";
"custom/work-vpn" = {
exec = "${work-vpn} --output";
return-type = "json";
on-click-right = "${work-vpn} --toggle";
interval = 2;
};
@@ -247,12 +256,14 @@ in
modules-left = lib.mkIf hyprlandEnabled [ "hyprland/workspaces" ];
modules-right = [
"custom/work-vpn-status"
"custom/work-vpn"
"clock"
];
"custom/work-vpn-status" = {
exec = "${work-vpn-status}";
"custom/work-vpn" = {
exec = "${work-vpn} --output";
return-type = "json";
on-click-right = "${work-vpn} --toggle";
interval = 2;
};
@@ -306,10 +317,14 @@ in
color: #${config.lib.colors.warning};
}
#custom-work-vpn-status {
#custom-work-vpn.connected {
color: #${config.lib.colors.warning};
}
#custom-work-vpn.disconnected {
color: #${config.lib.colors.foreground-dim};
}
#custom-container-status.running {
color: #${config.lib.colors.warning};
font-size: 30px;
+30 -2
View File
@@ -91,10 +91,10 @@ EOF
(pkgs.writeShellScriptBin "work-vpn" ''
case $1 in
up)
sudo sh -c "systemctl start openvpn-work-staging.service; systemctl start openvpn-work-production.service"
systemctl start work-vpn.target
;;
down)
sudo sh -c "systemctl stop openvpn-work-staging.service; systemctl stop openvpn-work-production.service"
systemctl stop work-vpn.target
;;
esac
'')
@@ -142,6 +142,34 @@ EOF
};
};
systemd.targets.work-vpn = lib.mkIf openvpnEnabled {
description = "Work VPN";
requires = [
"openvpn-work-staging.service"
"openvpn-work-production.service"
];
after = [
"openvpn-work-staging.service"
"openvpn-work-production.service"
];
};
systemd.services = lib.mkIf openvpnEnabled {
openvpn-work-staging.partOf = [ "work-vpn.target" ];
openvpn-work-production.partOf = [ "work-vpn.target" ];
};
security.polkit.extraConfig = lib.mkIf openvpnEnabled ''
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.systemd1.manage-units" &&
subject.user == "alex" &&
action.lookup("unit") == "work-vpn.target" &&
["start", "stop", "restart"].indexOf(action.lookup("verb")) >= 0) {
return polkit.Result.YES;
}
});
'';
age.secrets = {
"work-gitconfig" = lib.mkIf gitEnabled {
file = ../../../../secrets/pinwheel/work-gitconfig.age;