summary refs log tree commit diff
diff options
context:
space:
mode:
authorLuke Granger-Brown <git@lukegb.com>2022-09-24 17:14:59 +0100
committerLuke Granger-Brown <git@lukegb.com>2022-09-24 18:27:51 +0000
commitd1d41e4fa5cf92e5d35d9aea685929f7cf617b07 (patch)
tree7c8c80abe5eaf53a47f9bf8aa2d4dd43e87525ca
parent6fcaded221057f6bc60600bb84ff5578df902c47 (diff)
downloadnixpkgs-d1d41e4fa5cf92e5d35d9aea685929f7cf617b07.tar
nixpkgs-d1d41e4fa5cf92e5d35d9aea685929f7cf617b07.tar.gz
nixpkgs-d1d41e4fa5cf92e5d35d9aea685929f7cf617b07.tar.bz2
nixpkgs-d1d41e4fa5cf92e5d35d9aea685929f7cf617b07.tar.lz
nixpkgs-d1d41e4fa5cf92e5d35d9aea685929f7cf617b07.tar.xz
nixpkgs-d1d41e4fa5cf92e5d35d9aea685929f7cf617b07.tar.zst
nixpkgs-d1d41e4fa5cf92e5d35d9aea685929f7cf617b07.zip
ntfy: add options to turn off optional features
This splits out the things which are ntfy optional dependencies so
that they can be disabled - in particular, sleekxmpp is broken on Darwin
and because of the way the package is designed at the moment it isn't
possible to turn it off.

This also allows you to use newer or older python interpreters without
overriding e.g. "python39" to actually mean python310.
-rw-r--r--pkgs/tools/misc/ntfy/default.nix31
-rw-r--r--pkgs/top-level/all-packages.nix2
2 files changed, 21 insertions, 12 deletions
diff --git a/pkgs/tools/misc/ntfy/default.nix b/pkgs/tools/misc/ntfy/default.nix
index 8bee0c304f7..02f32adbbbf 100644
--- a/pkgs/tools/misc/ntfy/default.nix
+++ b/pkgs/tools/misc/ntfy/default.nix
@@ -1,15 +1,18 @@
 { lib
-, python39
+, stdenv
+, python
 , fetchFromGitHub
 , fetchpatch
+, withXmpp ? !stdenv.isDarwin
+, withMatrix ? true
+, withSlack ? true
+, withEmoji ? true
+, withPid ? true
+, withDbus ? stdenv.isLinux
 }:
 
 let
-  python = python39.override {
-    packageOverrides = self: super: {
-      ntfy-webpush = self.callPackage ./webpush.nix { };
-    };
-  };
+  ntfy-webpush = python.pkgs.callPackage ./webpush.nix { };
 in python.pkgs.buildPythonApplication rec {
   pname = "ntfy";
   version = "2.7.0";
@@ -27,16 +30,22 @@ in python.pkgs.buildPythonApplication rec {
     mock
   ];
 
-  propagatedBuildInputs = with python.pkgs; [
+  propagatedBuildInputs = with python.pkgs; ([
     requests ruamel-yaml appdirs
+    ntfy-webpush
+  ] ++ (lib.optionals withXmpp [
     sleekxmpp dnspython
+  ]) ++ (lib.optionals withMatrix [
+    matrix-client
+  ]) ++ (lib.optionals withSlack [
+    slack-sdk
+  ]) ++ (lib.optionals withEmoji [
     emoji
+  ]) ++ (lib.optionals withPid [
     psutil
-    matrix-client
+  ]) ++ (lib.optionals withDbus [
     dbus-python
-    ntfy-webpush
-    slack-sdk
-  ];
+  ]));
 
   patches = [
     # Fix Slack integration no longer working.
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index ff3535c7c78..ae42a7371c0 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -9447,7 +9447,7 @@ with pkgs;
   # ntfsprogs are merged into ntfs-3g
   ntfsprogs = pkgs.ntfs3g;
 
-  ntfy = callPackage ../tools/misc/ntfy {};
+  ntfy = callPackage ../tools/misc/ntfy { python = python39; };
 
   ntfy-sh = callPackage ../tools/misc/ntfy-sh { };