From 05b77f5b3487c8d6b8fe6bf6bdceed56b1851c6b Mon Sep 17 00:00:00 2001 From: Tigor Hutasuhut Date: Wed, 16 Oct 2024 10:51:40 +0700 Subject: [PATCH] ntfy-sh: client activation moved to hyprland module --- home/modules/hyprland/default.nix | 1 + home/modules/hyprland/ntfy-sh.nix | 13 +++++++++++++ system/services/ntfy-sh.nix | 19 ------------------- 3 files changed, 14 insertions(+), 19 deletions(-) create mode 100644 home/modules/hyprland/ntfy-sh.nix diff --git a/home/modules/hyprland/default.nix b/home/modules/hyprland/default.nix index db6a97a..6a4d7c5 100644 --- a/home/modules/hyprland/default.nix +++ b/home/modules/hyprland/default.nix @@ -21,6 +21,7 @@ in ./alacritty.nix ./swayosd.nix ./sway-notification-center.nix + ./ntfy-sh.nix ]; config = lib.mkIf cfg.enable { home.packages = with pkgs; [ diff --git a/home/modules/hyprland/ntfy-sh.nix b/home/modules/hyprland/ntfy-sh.nix new file mode 100644 index 0000000..1e98e69 --- /dev/null +++ b/home/modules/hyprland/ntfy-sh.nix @@ -0,0 +1,13 @@ +{ config, pkgs, lib, ... }: +let + hyprland = config.profile.hyprland; + cfg = config.profile.services.ntfy-sh.client; + inherit (lib) mkIf; +in +{ + config = mkIf (hyprland.enable && cfg.enable) { + wayland.windowManager.hyprland.settings.exec-once = [ + "${pkgs.ntfy-sh}/bin/ntfy subscribe --config /etc/ntfy/client.yml --from-config" + ]; + }; +} diff --git a/system/services/ntfy-sh.nix b/system/services/ntfy-sh.nix index 52962d1..76ee6db 100644 --- a/system/services/ntfy-sh.nix +++ b/system/services/ntfy-sh.nix @@ -50,25 +50,6 @@ lib.mkMerge [ NTFY_CONFIG = configPath; }; - systemd.services.ntfy-client = { - enable = true; - wantedBy = [ "multi-user.target" ]; - description = "ntfy client"; - after = [ "network-online.target" ]; - restartTriggers = [ (builtins.toJSON cfg.client.settings) ]; - environment = { - DISPLAY = ":0"; - DBUS_SESSION_BUS_ADDRESS = "unix:path=/run/user/${toString config.profile.user.uid}/bus"; - }; - path = [ pkgs.bash ]; - serviceConfig = { - User = toString config.profile.user.uid; - Group = toString config.profile.user.gid; - ExecStart = "${pkgs.ntfy-sh}/bin/ntfy subscribe --config ${configPath} --from-config"; - Restart = "on-failure"; - }; - }; - sops = { secrets = let