depot/ops/nixos/lib/home-manager/ntfy.nix
Luke Granger-Brown 02db8ea7cb ops/nixos/lib/hm: support macOS again
The ntfy package expects to have pyobjc available when running under Darwin,
which is currently broken in nixpkgs. There's a fairly involved ongoing effort
to package it again, but in the mean time we just patch out the dep. I'm using
the pushover backend anyway.

To avoid having to rebuild it rather than just fetch from the NixOS cache, I
only override it when running on Darwin.
2021-04-09 18:48:46 +01:00

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