sqlite_orm: 1.9 -> 1.9.1 (#379250)
[NixPkgs.git] / pkgs / by-name / un / undistract-me / package.nix
blob2bc59f15d3b0af343cc5e928681c7be611ab3ddc
2   lib,
3   stdenvNoCC,
4   fetchFromGitHub,
5   fetchpatch,
6   coreutils,
7   gnused,
8   libnotify,
9   pulseaudio,
10   sound-theme-freedesktop,
11   xprop,
14 stdenvNoCC.mkDerivation rec {
15   pname = "undistract-me";
16   version = "unstable-2020-08-09";
18   src = fetchFromGitHub {
19     owner = "jml";
20     repo = pname;
21     rev = "2f8ac25c6ad8efcf160d2b480825b1cbb6772aab";
22     hash = "sha256-Qw7Cu9q0ZgK/RTvyDdHM5N3eBaKjtYqYH0J+hKMUZX8=";
23   };
25   patches = [
26     # Don't block the terminal when notification sound is played
27     #
28     # See https://github.com/jml/undistract-me/pull/69
29     (fetchpatch {
30       url = "https://github.com/jml/undistract-me/commit/2356ebbe8bf2bcb4b95af1ae2bcdc786ce7cc6e8.patch";
31       sha256 = "sha256-Ij3OXTOnIQsYhKVmqjChhN1q4ASZ7waOkfQTTp5XfPo=";
32     })
34     # Fix showing notifications when using Wayland apps with XWayland
35     # running, or connection to X server fails.
36     #
37     # NOTE: Without a real X server, notifications will not be
38     # suppressed when the window running the command is focused.
39     #
40     # See https://github.com/jml/undistract-me/pull/71
41     (fetchpatch {
42       url = "https://github.com/jml/undistract-me/commit/3f4ceaf5a4eba8e3cb02236c48247f87e3d1124f.patch";
43       sha256 = "sha256-9AK9Jp3TXJ75Y+jwZXlwQ6j54FW1rOBddoktrm0VX68=";
44     })
45   ];
47   strictDeps = true;
49   # Patch in dependencies. Can't use makeWrapper because the bash
50   # functions will be sourced and invoked in a different environment
51   # for each command invocation.
52   postPatch = ''
53     for script in *.bash *.sh; do
54       substituteInPlace "$script" \
55         --replace /usr/share/undistract-me "$out/share/undistract-me" \
56         --replace basename ${coreutils}/bin/basename \
57         --replace 'cut ' '${coreutils}/bin/cut ' \
58         --replace date ${coreutils}/bin/date \
59         --replace dirname ${coreutils}/bin/dirname \
60         --replace sed ${gnused}/bin/sed \
61         --replace notify-send ${libnotify}/bin/notify-send \
62         --replace paplay ${pulseaudio}/bin/paplay \
63         --replace /usr/share/sounds/freedesktop ${sound-theme-freedesktop}/share/sounds/freedesktop \
64         --replace xprop ${xprop}/bin/xprop
65     done
66   '';
68   installPhase = ''
69     mkdir -p "$out/share/undistract-me" "$out/etc/profile.d" "$out/share/licenses/undistract-me"
70     cp long-running.bash "$out/share/undistract-me"
71     cp preexec.bash "$out/share/undistract-me"
72     cp undistract-me.sh "$out/etc/profile.d"
73     cp LICENSE "$out/share/licenses/undistract-me"
74   '';
76   meta = with lib; {
77     description = "Notifies you when long-running terminal commands complete";
78     homepage = "https://github.com/jml/undistract-me";
79     license = licenses.mit;
80     maintainers = with maintainers; [ kira-bruneau ];
81   };