forgejo-lts: 7.0.10 -> 7.0.11
[NixPkgs.git] / pkgs / by-name / he / headset-charge-indicator / package.nix
blobd365b4a5c673704bbca52b30b53a152b1944138a
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 {
11     owner = "centic9";
12     repo = "headset-charge-indicator";
13     rev = "6e20f81a4d6118c7385b831044c468af83103193";
14     sha256 = "sha256-eaAbqeFY+B3CcKJywC3vaRsWZNQENTbALc7L7uW0W6U=";
15   };
17   nativeBuildInputs = [ wrapGAppsHook3 gobject-introspection ];
19   buildInputs = [
20     (python3.withPackages (ps: with ps; [ pygobject3 ]))
21     headsetcontrol
22     gtk3
23     libayatana-appindicator
24   ];
26   installPhase = ''
27     mkdir -p $out/bin
28     cp $src/headset-charge-indicator.py $out/bin/headset-charge-indicator.py
29     chmod +x $out/bin/headset-charge-indicator.py
31     substituteInPlace \
32       $out/bin/headset-charge-indicator.py \
33       --replace "default='headsetcontrol'" "default='${headsetcontrol}/bin/headsetcontrol'"
35     cat << EOF > ${pname}.desktop
36     [Desktop Entry]
37     Name=Wireless headset app-indicator
38     Categories=Application;System
39     Exec=$out/bin/headset-charge-indicator.py
40     Terminal=false
41     Type=Application
42     X-GNOME-AutoRestart=true
43     X-GNOME-Autostart-enabled=true
44     EOF
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
50   '';
52   meta = with lib; {
53     homepage = "https://github.com/centic9/headset-charge-indicator";
54     description =
55       "A app-indicator for GNOME desktops for controlling some features of various wireless headsets";
56     longDescription =
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";
62   };