From d49478741fd06b0ee70d3f8d600bb1f31a30f806 Mon Sep 17 00:00:00 2001 From: Tigor Hutasuhut Date: Sun, 20 Oct 2024 17:20:54 +0700 Subject: [PATCH] ntfy-sh: uses fixed dbus session bus address and display --- home/modules/hyprland/ntfy-sh.nix | 6 +++--- system/services/ntfy-sh.nix | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/home/modules/hyprland/ntfy-sh.nix b/home/modules/hyprland/ntfy-sh.nix index 64aec32..73f3fdf 100644 --- a/home/modules/hyprland/ntfy-sh.nix +++ b/home/modules/hyprland/ntfy-sh.nix @@ -10,8 +10,8 @@ in ntfy-sh ]; - wayland.windowManager.hyprland.settings.exec-once = [ - "ntfy subscribe --config /etc/ntfy/client.yml --from-config" - ]; + # wayland.windowManager.hyprland.settings.exec-once = [ + # "ntfy subscribe --config /etc/ntfy/client.yml --from-config" + # ]; }; } diff --git a/system/services/ntfy-sh.nix b/system/services/ntfy-sh.nix index 76ee6db..1468465 100644 --- a/system/services/ntfy-sh.nix +++ b/system/services/ntfy-sh.nix @@ -50,6 +50,25 @@ lib.mkMerge [ NTFY_CONFIG = configPath; }; + systemd.services.ntfy-client = { + enable = true; + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ]; + environment = { + DISPLAY = ":0"; + DBUS_SESSION_BUS_ADDRESS = "unix:path=/run/user/${toString config.profile.user.uid}/bus"; + }; + restartTriggers = [ (builtins.toJSON cfg.client.settings) ]; + path = with pkgs; [ bash libnotify ]; + description = "ntfy-sh client"; + serviceConfig = { + ExecStart = "${pkgs.ntfy-sh}/bin/ntfy --debug subscribe --config /etc/ntfy/client.yml --from-config"; + Restart = "on-failure"; + User = config.profile.user.uid; + Group = config.profile.user.gid; + }; + }; + sops = { secrets = let