Files
nixpkgs/pkgs/development/python-modules/apprise/default.nix
Peter Kling a6fc888770 apprise: add support for macOS desktop notifications
Apprise supports desktop notifications on macOS (e.g., via `apprise -b "Hello World" "macosx://"`). This feature uses terminal-notifier under the hood. Unfortunately, the potential paths to terminal-notifier are hardcoded into apprise. Thus, nixpkgs's apprise does currently not support desktop notifications on macOS.

This PR adds the terminal-notifier dependency under macOS and patches the hardcoded paths to use nixpkgs's terminal-notifier.

(cherry picked from commit 3e99122005)
2026-01-11 09:09:16 +00:00

87 lines
1.6 KiB
Nix

{
lib,
apprise,
babel,
buildPythonPackage,
click,
cryptography,
fetchPypi,
gntp,
installShellFiles,
markdown,
paho-mqtt,
pytest-mock,
pytestCheckHook,
pythonOlder,
pyyaml,
requests,
requests-oauthlib,
setuptools,
stdenv,
terminal-notifier,
testers,
}:
buildPythonPackage rec {
pname = "apprise";
version = "1.9.5";
pyproject = true;
disabled = pythonOlder "3.7";
src = fetchPypi {
inherit pname version;
hash = "sha256-jzvjGLtCnCAXRw4zkoouMTy/dgD8dLgYR4KjcGDbNmo=";
};
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace apprise/plugins/macosx.py \
--replace-fail "/opt/homebrew/bin/terminal-notifier" "${lib.getExe' terminal-notifier "terminal-notifier"}"
'';
nativeBuildInputs = [ installShellFiles ];
build-system = [
babel
setuptools
];
dependencies = [
click
cryptography
markdown
pyyaml
requests
requests-oauthlib
];
nativeCheckInputs = [
gntp
paho-mqtt
pytest-mock
pytestCheckHook
];
postInstall = ''
installManPage packaging/man/apprise.1
'';
pythonImportsCheck = [ "apprise" ];
passthru = {
tests.version = testers.testVersion {
package = apprise;
version = "v${version}";
};
};
meta = {
description = "Push Notifications that work with just about every platform";
homepage = "https://github.com/caronc/apprise";
changelog = "https://github.com/caronc/apprise/releases/tag/v${version}";
license = lib.licenses.bsd2;
maintainers = with lib.maintainers; [ getchoo ];
mainProgram = "apprise";
};
}