depot/ops/nixos/lib/home-manager/ntfy.nix

25 lines
529 B
Nix

{ 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; };
};
}