From a3ed8a6da34e750e8497e8f0528851006f38b03e Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sun, 28 Mar 2021 23:08:02 +0000 Subject: [PATCH] hm: add ntfy everywhere --- ops/nixos/lib/home-manager/common.nix | 13 +++++++++++++ ops/nixos/lib/home-manager/ntfy.nix | 25 +++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 ops/nixos/lib/home-manager/ntfy.nix diff --git a/ops/nixos/lib/home-manager/common.nix b/ops/nixos/lib/home-manager/common.nix index b263686157..7a6390995b 100644 --- a/ops/nixos/lib/home-manager/common.nix +++ b/ops/nixos/lib/home-manager/common.nix @@ -3,6 +3,19 @@ let inherit (pkgs.stdenv.hostPlatform) isDarwin isLinux; in { + imports = [ ./ntfy.nix ]; + + programs.ntfy = { + enable = true; + settings = { + backends = [ "pushover" ]; + pushover = { + user_key = depot.ops.secrets.pushover.userKey; + api_token = depot.ops.secrets.pushover.tokens.depot; + }; + }; + }; + home.username = "lukegb"; home.homeDirectory = if isDarwin then "/Users/lukegb" else "/home/lukegb"; home.file = { diff --git a/ops/nixos/lib/home-manager/ntfy.nix b/ops/nixos/lib/home-manager/ntfy.nix new file mode 100644 index 0000000000..a6eeb89c79 --- /dev/null +++ b/ops/nixos/lib/home-manager/ntfy.nix @@ -0,0 +1,25 @@ +{ config, lib, pkgs, ... }: +with lib; +let + cfg = config.programs.ntfy; + format = pkgs.formats.yaml { }; + configFile = format.generate "ntfy.yml" cfg.settings; +in +{ + options.programs.ntfy = { + enable = mkEnableOption "ntfy"; + + settings = mkOption { + default = {}; + type = types.submodule { + freeformType = format.type; + }; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ pkgs.ntfy ]; + + xdg.configFile."ntfy/ntfy.yml" = mkIf (cfg.settings != { }) { source = configFile; }; + }; +}