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.
This commit is contained in:
Luke Granger-Brown 2022-09-24 17:14:59 +01:00
parent 6fcaded221
commit d1d41e4fa5
2 changed files with 23 additions and 14 deletions

View file

@ -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
sleekxmpp dnspython
emoji
psutil
matrix-client
dbus-python
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
]) ++ (lib.optionals withDbus [
dbus-python
]));
patches = [
# Fix Slack integration no longer working.

View file

@ -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 { };