From 02db8ea7cb992b564ab09ada3b4c74bdf60a70e8 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Fri, 9 Apr 2021 18:48:46 +0100 Subject: [PATCH] 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. --- ops/nixos/lib/home-manager/common.nix | 6 ++++++ ops/nixos/lib/home-manager/ntfy.nix | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ops/nixos/lib/home-manager/common.nix b/ops/nixos/lib/home-manager/common.nix index 7a6390995b..756ad9e689 100644 --- a/ops/nixos/lib/home-manager/common.nix +++ b/ops/nixos/lib/home-manager/common.nix @@ -7,6 +7,12 @@ in programs.ntfy = { enable = true; + package = if isDarwin then pkgs.ntfy.overrideAttrs (oldAttrs: { + postPatch = '' + substituteInPlace setup.py \ + --replace '"darwin"' '"darwin-disabled"' + ''; + }) else pkgs.ntfy; settings = { backends = [ "pushover" ]; pushover = { diff --git a/ops/nixos/lib/home-manager/ntfy.nix b/ops/nixos/lib/home-manager/ntfy.nix index a6eeb89c79..e365c7791a 100644 --- a/ops/nixos/lib/home-manager/ntfy.nix +++ b/ops/nixos/lib/home-manager/ntfy.nix @@ -9,6 +9,12 @@ in options.programs.ntfy = { enable = mkEnableOption "ntfy"; + package = mkOption { + default = pkgs.ntfy; + defaultText = "pkgs.ntfy"; + type = types.package; + }; + settings = mkOption { default = {}; type = types.submodule { @@ -18,7 +24,7 @@ in }; config = mkIf cfg.enable { - home.packages = [ pkgs.ntfy ]; + home.packages = [ cfg.package ]; xdg.configFile."ntfy/ntfy.yml" = mkIf (cfg.settings != { }) { source = configFile; }; };