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