1{
2 lib,
3 fetchFromGitHub,
4 fetchpatch,
5 buildPythonApplication,
6 appstream-glib,
7 dbus-python,
8 desktop-file-utils,
9 gettext,
10 glib,
11 gobject-introspection,
12 gtk3,
13 hicolor-icon-theme,
14 libappindicator,
15 libhandy,
16 meson,
17 ninja,
18 pkg-config,
19 pygobject3,
20 pyxdg,
21 systemd,
22 wrapGAppsHook3,
23}:
24
25buildPythonApplication rec {
26 pname = "cpupower-gui";
27 version = "1.0.0";
28
29 # This packages doesn't have a setup.py
30 format = "other";
31
32 src = fetchFromGitHub {
33 owner = "vagnum08";
34 repo = pname;
35 rev = "v${version}";
36 sha256 = "05lvpi3wgyi741sd8lgcslj8i7yi3wz7jwl7ca3y539y50hwrdas";
37 };
38
39 patches = [
40 # Fix build with 0.61, can be removed on next update
41 # https://hydra.nixos.org/build/171052557/nixlog/1
42 (fetchpatch {
43 url = "https://github.com/vagnum08/cpupower-gui/commit/97f8ac02fe33e412b59d3f3968c16a217753e74b.patch";
44 sha256 = "XYnpm03kq8JLMjAT73BMCJWlzz40IAuHESm715VV6G0=";
45 })
46 # Fixes https://github.com/vagnum08/cpupower-gui/issues/86
47 (fetchpatch {
48 url = "https://github.com/vagnum08/cpupower-gui/commit/22ea668aa4ecf848149ea4c150aa840a25dc6ff8.patch";
49 sha256 = "sha256-Mri7Af1Y79lt2pvZl4DQSvrqSLIJLIjzyXwMPFEbGVI=";
50 })
51 ];
52
53 nativeBuildInputs = [
54 appstream-glib
55 desktop-file-utils # needed for update-desktop-database
56 gettext
57 glib # needed for glib-compile-schemas
58 gobject-introspection # need for gtk namespace to be available
59 hicolor-icon-theme # needed for postinstall script
60 meson
61 ninja
62 pkg-config
63 wrapGAppsHook3
64
65 # Python packages
66 dbus-python
67 libappindicator
68 pygobject3
69 pyxdg
70 ];
71
72 buildInputs = [
73 glib
74 gtk3
75 libhandy
76 ];
77
78 propagatedBuildInputs = [
79 dbus-python
80 libappindicator
81 pygobject3
82 pyxdg
83 ];
84
85 mesonFlags = [
86 "-Dsystemddir=${placeholder "out"}/lib/systemd"
87 ];
88
89 preConfigure = ''
90 patchShebangs build-aux/meson/postinstall.py
91 '';
92
93 strictDeps = false;
94 dontWrapGApps = true;
95
96 makeWrapperArgs = [ "\${gappsWrapperArgs[@]}" ];
97
98 postFixup = ''
99 wrapPythonProgramsIn $out/lib "$out $propagatedBuildInputs"
100 '';
101
102 meta = with lib; {
103 description = "Change the frequency limits of your cpu and its governor";
104 mainProgram = "cpupower-gui";
105 homepage = "https://github.com/vagnum08/cpupower-gui/";
106 license = licenses.gpl3Plus;
107 maintainers = with maintainers; [ unode ];
108 };
109}