1{ lib 2, stdenv 3, buildPythonPackage 4, isPy3k 5, fetchFromGitHub 6, substituteAll 7, alsa-utils 8, libnotify 9, which 10, jeepney 11, loguru 12, pytestCheckHook 13, coreutils 14}: 15 16buildPythonPackage rec { 17 pname = "notify-py"; 18 version = "0.3.3"; 19 20 disabled = !isPy3k; 21 22 src = fetchFromGitHub { 23 owner = "ms7m"; 24 repo = pname; 25 rev = "v${version}"; 26 sha256 = "1n35adwsyhz304n4ifnsz6qzkymwhyqc8sg8d76qv5psv2xsnzlf"; 27 }; 28 29 patches = lib.optionals stdenv.isLinux [ 30 # hardcode paths to aplay and notify-send 31 (substituteAll { 32 src = ./linux-paths.patch; 33 aplay = "${alsa-utils}/bin/aplay"; 34 notifysend = "${libnotify}/bin/notify-send"; 35 }) 36 ] ++ lib.optionals stdenv.isDarwin [ 37 # hardcode path to which 38 (substituteAll { 39 src = ./darwin-paths.patch; 40 which = "${which}/bin/which"; 41 }) 42 ]; 43 44 propagatedBuildInputs = [ loguru ] 45 ++ lib.optionals stdenv.isLinux [ jeepney ]; 46 47 checkInputs = [ pytestCheckHook ]; 48 49 # Tests search for "afplay" binary which is built in to MacOS and not available in nixpkgs 50 preCheck = lib.optionalString stdenv.isDarwin '' 51 mkdir $TMP/bin 52 ln -s ${coreutils}/bin/true $TMP/bin/afplay 53 export PATH="$TMP/bin:$PATH" 54 ''; 55 56 pythonImportsCheck = [ "notifypy" ]; 57 58 meta = with lib; { 59 description = "Cross-platform desktop notification library for Python"; 60 homepage = "https://github.com/ms7m/notify-py"; 61 license = licenses.mit; 62 maintainers = with maintainers; [ austinbutler dotlambda ]; 63 }; 64}