From d1d41e4fa5cf92e5d35d9aea685929f7cf617b07 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sat, 24 Sep 2022 17:14:59 +0100 Subject: 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. --- pkgs/tools/misc/ntfy/default.nix | 31 ++++++++++++++++++++----------- pkgs/top-level/all-packages.nix | 2 +- 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 { }; -- cgit 1.4.1