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

32 lines
652 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";
package = mkOption {
default = pkgs.ntfy;
defaultText = "pkgs.ntfy";
type = types.package;
};
2021-03-28 23:08:02 +00:00
settings = mkOption {
default = {};
type = types.submodule {
freeformType = format.type;
};
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
2021-03-28 23:08:02 +00:00
xdg.configFile."ntfy/ntfy.yml" = mkIf (cfg.settings != { }) { source = configFile; };
};
}