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.
This commit is contained in:
Luke Granger-Brown 2021-04-09 18:48:46 +01:00
parent fcf39e6738
commit 02db8ea7cb
2 changed files with 13 additions and 1 deletions

View file

@ -7,6 +7,12 @@ in
programs.ntfy = { programs.ntfy = {
enable = true; enable = true;
package = if isDarwin then pkgs.ntfy.overrideAttrs (oldAttrs: {
postPatch = ''
substituteInPlace setup.py \
--replace '"darwin"' '"darwin-disabled"'
'';
}) else pkgs.ntfy;
settings = { settings = {
backends = [ "pushover" ]; backends = [ "pushover" ];
pushover = { pushover = {

View file

@ -9,6 +9,12 @@ in
options.programs.ntfy = { options.programs.ntfy = {
enable = mkEnableOption "ntfy"; enable = mkEnableOption "ntfy";
package = mkOption {
default = pkgs.ntfy;
defaultText = "pkgs.ntfy";
type = types.package;
};
settings = mkOption { settings = mkOption {
default = {}; default = {};
type = types.submodule { type = types.submodule {
@ -18,7 +24,7 @@ in
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ pkgs.ntfy ]; home.packages = [ cfg.package ];
xdg.configFile."ntfy/ntfy.yml" = mkIf (cfg.settings != { }) { source = configFile; }; xdg.configFile."ntfy/ntfy.yml" = mkIf (cfg.settings != { }) { source = configFile; };
}; };