This commit is contained in:
2026-07-31 10:14:25 -03:00
parent 3629b9465f
commit b64b4b472d
2 changed files with 34 additions and 3 deletions
+17 -1
View File
@@ -97,7 +97,23 @@
}; };
openspec.enable = true; openspec.enable = true;
power-profiles.enable = true; power-profiles.enable = true;
ntfy-notify.enable = true; ntfy-notify = {
enable = true;
server = "https://ntfy.joaoporta.com";
subscriptions = [
{
priority = "normal";
topic = "music-download";
title = "Music Downloaded";
}
{
priority = "critical";
topic = "joao-kanban";
title = "Kanban Update";
}
];
};
bitwarden.enable = true; bitwarden.enable = true;
}; };
home.packages = home.packages =
+17 -2
View File
@@ -6,6 +6,16 @@
}: }:
let let
cfg = config.custom.ntfy-notify; cfg = config.custom.ntfy-notify;
ntfy-notify = pkgs.writeShellApplication {
name = "ntfy-notify-authenticated";
runtimeInputs = with pkgs; [ ntfy-sh rbw ];
text = ''
username="$(rbw get --field username ntfy.joaoporta.com)"
password="$(rbw get ntfy.joaoporta.com)"
export NTFY_USER="$username:$password"
exec ntfy subscribe --from-config
'';
};
in in
{ {
options.custom.ntfy-notify = { options.custom.ntfy-notify = {
@@ -24,6 +34,10 @@ in
type = lib.types.str; type = lib.types.str;
description = "ntfy topic to subscribe to."; description = "ntfy topic to subscribe to.";
}; };
title = lib.mkOption {
type = lib.types.str;
description = "Notification title for this topic";
};
priority = lib.mkOption { priority = lib.mkOption {
type = lib.types.enum [ "low" "normal" "critical" ]; type = lib.types.enum [ "low" "normal" "critical" ];
default = "normal"; default = "normal";
@@ -35,6 +49,7 @@ in
{ {
topic = "joao-kanban"; topic = "joao-kanban";
priority = "critical"; priority = "critical";
title = "Kanban Update";
} }
]; ];
description = '' description = ''
@@ -56,7 +71,7 @@ in
subscribe: subscribe:
'' + lib.concatMapStringsSep "\n" (sub: '' + lib.concatMapStringsSep "\n" (sub:
let let
cmd = "${lib.getExe pkgs.libnotify} -a Kanban -u ${sub.priority} \"Kanban Update\" \"$m\""; cmd = "${lib.getExe pkgs.libnotify} -a ntfy -u ${sub.priority} \"${sub.title}\" \"$m\"";
in in
" - topic: ${cfg.server}/${sub.topic}\n" " - topic: ${cfg.server}/${sub.topic}\n"
+ " command: ${cmd}" + " command: ${cmd}"
@@ -71,7 +86,7 @@ in
}; };
Service = { Service = {
Type = "simple"; Type = "simple";
ExecStart = "${pkgs.ntfy-sh}/bin/ntfy subscribe --from-config"; ExecStart = "${ntfy-notify}/bin/ntfy-notify-authenticated";
Restart = "on-failure"; Restart = "on-failure";
RestartSec = 10; RestartSec = 10;
}; };