Move telegram-notifications into options
This commit is contained in:
parent
4c811c1ad4
commit
bc795e9df9
|
@ -9,6 +9,7 @@
|
|||
./lockscreen
|
||||
./makemkv
|
||||
./rdp
|
||||
./telegram-notifications
|
||||
./username
|
||||
];
|
||||
}
|
||||
|
|
|
@ -11,9 +11,7 @@ let
|
|||
});
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
"${inputs.self}/modules/telegram-notifications"
|
||||
];
|
||||
services.az-telegram-notifications.enable = true;
|
||||
|
||||
age.secrets.dkim2liCh = {
|
||||
file = "${inputs.self}/scrts/dkim_2li.ch.age";
|
||||
|
|
|
@ -6,9 +6,8 @@ let
|
|||
'';
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
"${inputs.self}/modules/telegram-notifications"
|
||||
];
|
||||
services.az-telegram-notifications.enable = true;
|
||||
|
||||
age.secrets.webdavSecrets = {
|
||||
file = "${inputs.self}/scrts/webdav_andreas.age";
|
||||
path = "/home/${config.az-username}/.config/rclone/rclone.conf";
|
||||
|
|
|
@ -43,9 +43,7 @@ let
|
|||
${pkgs.restic}/bin/restic --password-file ${password_file} mount /tmp/restic'';
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
"${inputs.self}/modules/telegram-notifications"
|
||||
];
|
||||
services.az-telegram-notifications.enable = true;
|
||||
|
||||
age.secrets.infomaniakEnv = {
|
||||
file = "${inputs.self}/scrts/infomaniak_env.age";
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
, time
|
||||
}: { config, inputs, pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
"${inputs.self}/modules/telegram-notifications"
|
||||
];
|
||||
services.az-telegram-notifications.enable = true;
|
||||
|
||||
age.secrets.resticKey.file = "${inputs.self}/scrts/restic.key.age";
|
||||
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
, time
|
||||
}: { config, inputs, pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
"${inputs.self}/modules/telegram-notifications"
|
||||
];
|
||||
services.az-telegram-notifications.enable = true;
|
||||
|
||||
age.secrets.resticKey.file = "${inputs.self}/scrts/restic.key.age";
|
||||
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
, time
|
||||
}: { config, inputs, pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
"${inputs.self}/modules/telegram-notifications"
|
||||
];
|
||||
services.az-telegram-notifications.enable = true;
|
||||
|
||||
age.secrets.resticKey.file = "${inputs.self}/scrts/restic.key.age";
|
||||
|
||||
|
|
|
@ -3,9 +3,8 @@ let
|
|||
repository = "/var/lib/restic-server";
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
"${inputs.self}/modules/telegram-notifications"
|
||||
];
|
||||
services.az-telegram-notifications.enable = true;
|
||||
|
||||
age.secrets.resticKey = {
|
||||
file = "${inputs.self}/scrts/restic.key.age";
|
||||
mode = "440";
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
{ config, inputs, pkgs, ... }:
|
||||
{ config, inputs, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.services.az-telegram-notifications;
|
||||
|
||||
send-to-telegram = pkgs.writeShellScript "send-to-telegram" ''
|
||||
export $(${pkgs.gnugrep}/bin/grep -v '^#' ${config.age.secrets.telegramNotifyEnv.path} | ${pkgs.findutils}/bin/xargs)
|
||||
URL="https://api.telegram.org/bot$TELEGRAM_KEY/sendMessage"
|
||||
|
@ -16,15 +18,21 @@ let
|
|||
$UNITSTATUS"'';
|
||||
in
|
||||
{
|
||||
age.secrets.telegramNotifyEnv.file = "${inputs.self}/scrts/telegram_notify_env.age";
|
||||
systemd.services."unit-status-telegram@" = {
|
||||
description = "Unit Status Telegram Service";
|
||||
unitConfig = {
|
||||
After = "network-online.target";
|
||||
};
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStart = "${unit-status-telegram} %I";
|
||||
options = {
|
||||
services.az-telegram-notifications.enable = lib.mkEnableOption "Enable Telegram Notifications";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
age.secrets.telegramNotifyEnv.file = "${inputs.self}/scrts/telegram_notify_env.age";
|
||||
systemd.services."unit-status-telegram@" = {
|
||||
description = "Unit Status Telegram Service";
|
||||
unitConfig = {
|
||||
After = "network-online.target";
|
||||
};
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStart = "${unit-status-telegram} %I";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue