setup agenix and migrate from matrix-commander-rs to ntfy for phone notifications

This commit is contained in:
2026-07-26 15:53:57 +02:00
parent 2107d23209
commit 5db8135dd5
6 changed files with 99 additions and 62 deletions
@@ -3,44 +3,26 @@
environment.systemPackages = with pkgs; [
libnotify # Library that sends desktop notifications to a notification daemon
socat # Utility for bidirectional data transfer between two independent data channels (used to communicate between hyprland and awww to change wallpapers dinamically)
matrix-commander-rs # matrix client used to send notifications from scripts to my phone
# battery notifications
self.packages.${pkgs.system}.custom-batterynotify
self.packages.${pkgs.system}.custom-batterywarning
# checks if matrix-commander-rs is installed and logged in
self.packages.${pkgs.system}.custom-checkMatrix
self.packages.${pkgs.system}.custom-gitnotify # checks if git is set up
self.packages.${pkgs.system}.custom-checkKdrive # check if kdrive is set up with rclone
zoom-us
];
};
perSystem = {pkgs, ...}: {
packages.custom-checkMatrix = pkgs.writeShellApplication {
name = "custom-checkMatrix";
runtimeInputs = with pkgs; [
matrix-commander-rs
libnotify
];
text = ''
expected="@totorile1:unredacted.org"
current="$(matrix-commander-rs --whoami | tr -d '\n')"
if [ "$current" != "$expected" ]; then
notify-send "matrix-commander-rs" \
"You are not logged in as @totorile1:unredacted.org\nLog:\n$current"
fi
'';
};
packages.custom-gitnotify = pkgs.writeShellApplication {
name = "custom-gitnotify";
runtimeInputs = with pkgs; [
git
libnotify
curl
];
text = ''
# shellcheck disable=SC1091
source /run/agenix/ntfy
# Check if git is installed
if ! command -v git >/dev/null 2>&1; then
exit 0
@@ -53,9 +35,10 @@
notify-send \
"Git not configured" \
"Set your identity\n or remove this warning by removing the custom-gitnotify line in\n ~/nixos/modules/applications/hyprland.nix"
matrix-commander-rs --verbose -m "Git not configured.<br>Set your identify or remove this warning by removing the custom-gitnotify in ~/nixos/modules/applications/hyprland.nix<br><a href=\"https://matrix.to/#/@notificationbot_0000:matrix.org\">@notificationbot_0000</a>" \
--html \
-r "\!BXRRokBmEdNOyYdfOF:matrix.org"
curl \
-u ":$NTFY_TOKEN" \
-d "Git not configured" \
"$NTFY_SERVER/Alerts"
fi
'';
};