1{
2 lib,
3 buildPythonApplication,
4 fetchFromGitHub,
5 gobject-introspection,
6 gtk3,
7 libappindicator,
8 libpulseaudio,
9 librsvg,
10 pycairo,
11 pygobject3,
12 six,
13 wrapGAppsHook3,
14 xlib,
15}:
16
17buildPythonApplication {
18 pname = "hushboard";
19 version = "unstable-2021-03-17";
20 format = "setuptools";
21
22 src = fetchFromGitHub {
23 owner = "stuartlangridge";
24 repo = "hushboard";
25 rev = "c16611c539be111891116a737b02c5fb359ad1fc";
26 sha256 = "06jav6j0bsxhawrq31cnls8zpf80fpwk0cak5s82js6wl4vw2582";
27 };
28
29 nativeBuildInputs = [
30 wrapGAppsHook3
31 gobject-introspection
32 ];
33
34 buildInputs = [
35 gtk3
36 libappindicator
37 libpulseaudio
38 ];
39
40 propagatedBuildInputs = [
41 pycairo
42 pygobject3
43 six
44 xlib
45 ];
46
47 postPatch = ''
48 substituteInPlace hushboard/_pulsectl.py \
49 --replace "ctypes.util.find_library('libpulse') or 'libpulse.so.0'" "'${libpulseaudio}/lib/libpulse.so.0'"
50 substituteInPlace snap/gui/hushboard.desktop \
51 --replace "\''${SNAP}/hushboard/icons/hushboard.svg" "hushboard"
52 '';
53
54 postInstall = ''
55 # Fix tray icon, see e.g. https://github.com/NixOS/nixpkgs/pull/43421
56 wrapProgram $out/bin/hushboard \
57 --set GDK_PIXBUF_MODULE_FILE "${librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"
58
59 mkdir -p $out/share/applications $out/share/icons/hicolor/{scalable,512x512}/apps
60 cp snap/gui/hushboard.desktop $out/share/applications
61 cp hushboard/icons/hushboard.svg $out/share/icons/hicolor/scalable/apps
62 cp hushboard-512.png $out/share/icons/hicolor/512x512/apps/hushboard.png
63 '';
64
65 # There are no tests
66 doCheck = false;
67
68 meta = with lib; {
69 homepage = "https://kryogenix.org/code/hushboard/";
70 license = licenses.mit;
71 description = "Mute your microphone while typing";
72 mainProgram = "hushboard";
73 platforms = platforms.linux;
74 maintainers = with maintainers; [ keysmashes ];
75 };
76}