summary refs log tree commit diff
path: root/pkgs/tools/misc/gwe/default.nix
blob: 4a4b02b5370611827e58221955e3efde15de9906 (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
{ lib
, stdenv
, fetchFromGitLab
, wrapGAppsHook
, pkg-config
, meson
, ninja
, cmake
, gobject-introspection
, desktop-file-utils
, python3
, gtk3
, libdazzle
, libappindicator-gtk3
, libnotify
, nvidia_x11
 }:

let
 pythonEnv = python3.withPackages (pypkgs: with pypkgs; [
   injector
   matplotlib
   peewee
   pynvml
   pygobject3
   xlib
   pyxdg
   requests
   rx
   gtk3
 ]);
in stdenv.mkDerivation rec {
  pname = "gwe";
  version = "0.15.6";

  src = fetchFromGitLab {
    owner = "leinardi";
    repo = pname;
    rev = version;
    sha256 = "sha256-xlAz67sThXZ5o2kABb+aQI/7N7jmRpWU/5m24u8TkII=";
  };

  prePatch = ''
    patchShebangs scripts/{make_local_manifest,meson_post_install}.py

    substituteInPlace gwe/repository/nvidia_repository.py \
      --replace "from py3nvml import py3nvml" "import pynvml" \
      --replace "py3nvml.py3nvml" "pynvml" \
      --replace "py3nvml" "pynvml"
  '';

  nativeBuildInputs = [
    wrapGAppsHook
    pkg-config
    meson
    ninja
    cmake
    gobject-introspection
    desktop-file-utils
    pythonEnv
  ];

  buildInputs = [
    gtk3
    libdazzle
    libappindicator-gtk3
    libnotify
  ];

  postInstall = ''
    mv $out/bin/gwe $out/lib/gwe-bin

    makeWrapper ${pythonEnv}/bin/python $out/bin/gwe \
      --add-flags "$out/lib/gwe-bin" \
      --prefix LD_LIBRARY_PATH : "/run/opengl-driver/lib" \
      --prefix PATH : "${builtins.concatStringsSep ":" [ (lib.makeBinPath [ nvidia_x11 nvidia_x11.settings ]) "/run/wrappers/bin" ]}" \
      --unset "SHELL" \
      ''${gappsWrapperArgs[@]}
  '';

  meta = with lib; {
    description = "System utility designed to provide information, control the fans and overclock your NVIDIA card";
    homepage = "https://gitlab.com/leinardi/gwe";
    platforms = platforms.linux;
    license = licenses.gpl3Only;
    maintainers = [ maintainers.ivar ];
  };
}