1 { lib, stdenv, fetchFromGitHub, headsetcontrol, wrapGAppsHook3, python3, gtk3
2 , gobject-introspection, libayatana-appindicator }:
4 stdenv.mkDerivation rec {
5 # The last versioned release is 1.0.0.0 from 2020, since then there were updates but no versioned release.
6 # This is not marked unstable because upstream encourages installation from source.
7 pname = "headset-charge-indicator";
8 version = "2021-08-15";
10 src = fetchFromGitHub {
12 repo = "headset-charge-indicator";
13 rev = "6e20f81a4d6118c7385b831044c468af83103193";
14 sha256 = "sha256-eaAbqeFY+B3CcKJywC3vaRsWZNQENTbALc7L7uW0W6U=";
17 nativeBuildInputs = [ wrapGAppsHook3 gobject-introspection ];
20 (python3.withPackages (ps: with ps; [ pygobject3 ]))
23 libayatana-appindicator
28 cp $src/headset-charge-indicator.py $out/bin/headset-charge-indicator.py
29 chmod +x $out/bin/headset-charge-indicator.py
32 $out/bin/headset-charge-indicator.py \
33 --replace "default='headsetcontrol'" "default='${headsetcontrol}/bin/headsetcontrol'"
35 cat << EOF > ${pname}.desktop
37 Name=Wireless headset app-indicator
38 Categories=Application;System
39 Exec=$out/bin/headset-charge-indicator.py
42 X-GNOME-AutoRestart=true
43 X-GNOME-Autostart-enabled=true
46 mkdir -p $out/share/applications
47 mkdir -p $out/etc/xdg/autostart
48 cp ${pname}.desktop $out/share/applications/${pname}.desktop
49 cp ${pname}.desktop $out/etc/xdg/autostart/${pname}.desktop
53 homepage = "https://github.com/centic9/headset-charge-indicator";
55 "A app-indicator for GNOME desktops for controlling some features of various wireless headsets";
57 "A simple app-indicator for GNOME desktops to display the battery charge of some wireless headsets which also allows to control some functions like LEDs, sidetone and others.";
58 platforms = platforms.linux;
59 maintainers = with maintainers; [ zebreus ];
60 license = licenses.bsd2;
61 mainProgram = "headset-charge-indicator.py";