about summary refs log tree commit diff
path: root/pkgs/os-specific/linux/cpupower-gui/default.nix
blob: 754f8e1396152d41a3ec20e45150cef4bca3d6e6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, buildPythonApplication
, appstream-glib
, dbus-python
, desktop-file-utils
, gettext
, glib
, gobject-introspection
, gtk3
, hicolor-icon-theme
, libappindicator
, libhandy
, meson
, ninja
, pkg-config
, pygobject3
, pyxdg
, systemd
, wrapGAppsHook3
}:

buildPythonApplication rec {
  pname = "cpupower-gui";
  version = "1.0.0";

  # This packages doesn't have a setup.py
  format = "other";

  src = fetchFromGitHub {
    owner = "vagnum08";
    repo = pname;
    rev = "v${version}";
    sha256 = "05lvpi3wgyi741sd8lgcslj8i7yi3wz7jwl7ca3y539y50hwrdas";
  };

  patches = [
    # Fix build with 0.61, can be removed on next update
    # https://hydra.nixos.org/build/171052557/nixlog/1
    (fetchpatch {
      url = "https://github.com/vagnum08/cpupower-gui/commit/97f8ac02fe33e412b59d3f3968c16a217753e74b.patch";
      sha256 = "XYnpm03kq8JLMjAT73BMCJWlzz40IAuHESm715VV6G0=";
    })
  ];

  nativeBuildInputs = [
    appstream-glib
    desktop-file-utils # needed for update-desktop-database
    gettext
    glib # needed for glib-compile-schemas
    gobject-introspection # need for gtk namespace to be available
    hicolor-icon-theme # needed for postinstall script
    meson
    ninja
    pkg-config
    wrapGAppsHook3

    # Python packages
    dbus-python
    libappindicator
    pygobject3
    pyxdg
  ];

  buildInputs = [
    glib
    gtk3
    libhandy
  ];

  propagatedBuildInputs = [
    dbus-python
    libappindicator
    pygobject3
    pyxdg
  ];

  mesonFlags = [
    "-Dsystemddir=${placeholder "out"}/lib/systemd"
  ];

  preConfigure = ''
    patchShebangs build-aux/meson/postinstall.py
  '';

  strictDeps = false;
  dontWrapGApps = true;

  makeWrapperArgs = [ "\${gappsWrapperArgs[@]}" ];

  postFixup = ''
    wrapPythonProgramsIn $out/lib "$out $propagatedBuildInputs"
  '';

  meta = with lib; {
    description = "Change the frequency limits of your cpu and its governor";
    mainProgram = "cpupower-gui";
    homepage = "https://github.com/vagnum08/cpupower-gui/";
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [ unode ];
  };
}