ntfy
This commit is contained in:
@@ -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 =
|
||||||
|
|||||||
@@ -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;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user