2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
pythonOlder,
|
|
|
|
fetchFromGitHub,
|
|
|
|
substituteAll,
|
|
|
|
alsa-utils,
|
|
|
|
libnotify,
|
|
|
|
which,
|
|
|
|
poetry-core,
|
|
|
|
pythonRelaxDepsHook,
|
|
|
|
jeepney,
|
|
|
|
loguru,
|
|
|
|
pytest,
|
|
|
|
dbus,
|
|
|
|
coreutils,
|
2021-06-28 23:13:55 +00:00
|
|
|
}:
|
2020-10-07 09:15:18 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
2021-06-06 07:54:09 +00:00
|
|
|
pname = "notify-py";
|
2023-02-02 18:25:31 +00:00
|
|
|
version = "0.3.42";
|
2023-01-11 07:51:40 +00:00
|
|
|
format = "pyproject";
|
2020-10-07 09:15:18 +00:00
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
disabled = pythonOlder "3.6";
|
|
|
|
|
2021-06-06 07:54:09 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ms7m";
|
|
|
|
repo = pname;
|
2023-01-11 07:51:40 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2023-02-02 18:25:31 +00:00
|
|
|
hash = "sha256-XtjJImH9UwPPZS/Yqs8S5xGXOLBRmJRawzxWXoPWvrM=";
|
2020-10-07 09:15:18 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
patches =
|
|
|
|
lib.optionals stdenv.isLinux [
|
|
|
|
# hardcode paths to aplay and notify-send
|
|
|
|
(substituteAll {
|
|
|
|
src = ./linux-paths.patch;
|
|
|
|
aplay = "${alsa-utils}/bin/aplay";
|
|
|
|
notifysend = "${libnotify}/bin/notify-send";
|
|
|
|
})
|
|
|
|
]
|
|
|
|
++ lib.optionals stdenv.isDarwin [
|
|
|
|
# hardcode path to which
|
|
|
|
(substituteAll {
|
|
|
|
src = ./darwin-paths.patch;
|
|
|
|
which = "${which}/bin/which";
|
|
|
|
})
|
|
|
|
];
|
2021-06-28 23:13:55 +00:00
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
poetry-core
|
|
|
|
pythonRelaxDepsHook
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonRelaxDeps = [ "loguru" ];
|
2022-12-17 10:02:37 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
propagatedBuildInputs = [ loguru ] ++ lib.optionals stdenv.isLinux [ jeepney ];
|
2020-10-07 09:15:18 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeCheckInputs = [ pytest ] ++ lib.optionals stdenv.isLinux [ dbus ];
|
2020-10-07 09:15:18 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
checkPhase =
|
|
|
|
if stdenv.isDarwin then
|
|
|
|
''
|
|
|
|
# Tests search for "afplay" binary which is built in to macOS and not available in nixpkgs
|
|
|
|
mkdir $TMP/bin
|
|
|
|
ln -s ${coreutils}/bin/true $TMP/bin/afplay
|
|
|
|
PATH="$TMP/bin:$PATH" pytest
|
|
|
|
''
|
|
|
|
else if stdenv.isLinux then
|
|
|
|
''
|
|
|
|
dbus-run-session \
|
|
|
|
--config-file=${dbus}/share/dbus-1/session.conf \
|
|
|
|
pytest
|
|
|
|
''
|
|
|
|
else
|
|
|
|
''
|
|
|
|
pytest
|
|
|
|
'';
|
2020-10-07 09:15:18 +00:00
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
# GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name
|
|
|
|
# org.freedesktop.Notifications was not provided by any .service files
|
|
|
|
doCheck = false;
|
|
|
|
|
2020-10-07 09:15:18 +00:00
|
|
|
pythonImportsCheck = [ "notifypy" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
2021-06-28 23:13:55 +00:00
|
|
|
description = "Cross-platform desktop notification library for Python";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "notifypy";
|
2021-06-28 23:13:55 +00:00
|
|
|
homepage = "https://github.com/ms7m/notify-py";
|
2023-01-11 07:51:40 +00:00
|
|
|
changelog = "https://github.com/ms7m/notify-py/releases/tag/v${version}";
|
2020-10-07 09:15:18 +00:00
|
|
|
license = licenses.mit;
|
2024-06-05 15:53:02 +00:00
|
|
|
maintainers = with maintainers; [
|
|
|
|
austinbutler
|
|
|
|
dotlambda
|
|
|
|
];
|
2020-10-07 09:15:18 +00:00
|
|
|
};
|
|
|
|
}
|