diff --git a/modules/utilities/agenix.nix b/modules/utilities/agenix.nix
index 2011d7a..0ca0d21 100644
--- a/modules/utilities/agenix.nix
+++ b/modules/utilities/agenix.nix
@@ -6,8 +6,11 @@
age.identityPaths = [
"/home/tomasr/.ssh/id_ed25519"
];
- age.secrets.my-secret = {
- file = ../../secrets/my-secret.age;
+ age.secrets.ntfy = {
+ file = ../../secrets/ntfy.age;
+ owner = "tomasr";
+ group = "users";
+ mode = "0400";
};
};
}
diff --git a/modules/utilities/autoUpdate.nix b/modules/utilities/autoUpdate.nix
index 3c4fa78..290c8a2 100644
--- a/modules/utilities/autoUpdate.nix
+++ b/modules/utilities/autoUpdate.nix
@@ -1,5 +1,8 @@
{self, ...}: {
- flake.nixosModules.autoUpdate-laptop = {pkgs, ...}: {
+ flake.nixosModules.autoUpdate-laptop = {pkgs, config, ...}: {
+ age.secrets.ntfy = {
+ file = ../../secrets/ntfy.age;
+ };
# Ensure your script is available system-wide
environment.systemPackages = [
self.packages.${pkgs.system}.custom-autoupdate-laptop
@@ -12,6 +15,9 @@
description = "NixOS flake auto update";
serviceConfig = {
+ Environment = [
+ "NTFY_SECRET=${config.age.secrets.ntfy.path}"
+ ];
Type = "oneshot";
ExecStart = "/run/current-system/sw/bin/custom-autoupdate";
@@ -98,11 +104,13 @@
runtimeInputs = with pkgs; [
git
nixos-rebuild
- matrix-commander-rs
+ curl
libnotify
];
text = ''
+ # shellcheck disable=SC1090
+ source "$NTFY_SECRET"
set -e
FLAKE_DIR="/home/tomasr/nixos"
@@ -128,9 +136,11 @@
notify-send "Flake autoupdate" "Rebuild OK"
- matrix-commander-rs --verbose -m "Flake rebuild succesfull.
@notificationbot_0000" \
- --html \
- -r "\!BXRRokBmEdNOyYdfOF:matrix.org"
+ curl \
+ -u ":$NTFY_TOKEN" \
+ -d "Flake rebuild successful" \
+ -H "Title: Flake autoupdate" \
+ "$NTFY_SERVER/Alerts"
else
notify-send "Flake autoupdate" "No changes"
git -C "$FLAKE_DIR" push
@@ -141,9 +151,12 @@
notify-send -u critical "Flake autoupdate" "FAILED"
- matrix-commander-rs --verbose -m "Flake rebuild failed.
Error:
$ERROR_MSG