2021-06-28 23:13:55 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, buildPythonPackage
|
|
|
|
, isPy3k
|
|
|
|
, fetchFromGitHub
|
|
|
|
, substituteAll
|
|
|
|
, alsa-utils
|
|
|
|
, libnotify
|
|
|
|
, which
|
|
|
|
, jeepney
|
|
|
|
, loguru
|
|
|
|
, pytestCheckHook
|
|
|
|
, coreutils
|
|
|
|
}:
|
2020-10-07 09:15:18 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
2021-06-06 07:54:09 +00:00
|
|
|
pname = "notify-py";
|
|
|
|
version = "0.3.3";
|
2020-10-07 09:15:18 +00:00
|
|
|
|
|
|
|
disabled = !isPy3k;
|
|
|
|
|
2021-06-06 07:54:09 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ms7m";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "1n35adwsyhz304n4ifnsz6qzkymwhyqc8sg8d76qv5psv2xsnzlf";
|
2020-10-07 09:15:18 +00:00
|
|
|
};
|
|
|
|
|
2021-06-28 23:13:55 +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-06 07:54:09 +00:00
|
|
|
propagatedBuildInputs = [ loguru ]
|
|
|
|
++ lib.optionals stdenv.isLinux [ jeepney ];
|
2020-10-07 09:15:18 +00:00
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
checkInputs = [ pytestCheckHook ];
|
2020-10-07 09:15:18 +00:00
|
|
|
|
2021-06-06 07:54:09 +00:00
|
|
|
# Tests search for "afplay" binary which is built in to MacOS and not available in nixpkgs
|
2021-06-28 23:13:55 +00:00
|
|
|
preCheck = lib.optionalString stdenv.isDarwin ''
|
2021-06-06 07:54:09 +00:00
|
|
|
mkdir $TMP/bin
|
|
|
|
ln -s ${coreutils}/bin/true $TMP/bin/afplay
|
|
|
|
export PATH="$TMP/bin:$PATH"
|
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";
|
|
|
|
homepage = "https://github.com/ms7m/notify-py";
|
2020-10-07 09:15:18 +00:00
|
|
|
license = licenses.mit;
|
2021-06-28 23:13:55 +00:00
|
|
|
maintainers = with maintainers; [ austinbutler dotlambda ];
|
2020-10-07 09:15:18 +00:00
|
|
|
};
|
|
|
|
}
|