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

26 lines
529 B
Nix
Raw Normal View History

2021-03-28 23:08:02 +00:00
{ 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; };
};
}