AquaticOS/modules/services/ntfy-client.nix

37 lines
No EOL
957 B
Nix

{ inputs, ... }:
{
flake.modules.nixos.ntfy-client =
{ pkgs, ... }:
let
ntfyTopic = "etc-notifications";
in
{
environment.systemPackages = with pkgs; [
ntfy-sh
libnotify
];
systemd.user.services.ntfy-to-desktop = {
description = "Receive ntfy notifications and display locally";
wantedBy = [ "default.target" ];
after = [ "graphical-session.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.ntfy-sh}/bin/ntfy subscribe ${ntfyTopic} '${pkgs.libnotify}/bin/notify-send \"$t\" \"$m\"'";
Restart = "on-failure";
RestartSec = "5s";
Environment = "PATH=${pkgs.bash}/bin";
};
};
home-manager.sharedModules = with inputs.self.modules.homeManager; [
ntfy-client
];
};
flake.modules.homeManager.ntfy-client =
{
xdg.configFile."ntfy/client.yml".text = ''
default-host: http://192.168.0.80:4351
'';
};
}