1{
2 lib,
3 stdenv,
4 fetchFromGitLab,
5 wrapGAppsHook3,
6 pkg-config,
7 meson,
8 ninja,
9 cmake,
10 gobject-introspection,
11 desktop-file-utils,
12 python3,
13 gtk3,
14 libdazzle,
15 libappindicator-gtk3,
16 libnotify,
17 nvidia_x11,
18}:
19
20let
21 pythonEnv = python3.withPackages (
22 pypkgs: with pypkgs; [
23 injector
24 matplotlib
25 peewee
26 pynvml
27 pygobject3
28 xlib
29 pyxdg
30 requests
31 rx
32 gtk3
33 reactivex
34 setuptools
35 ]
36 );
37in
38stdenv.mkDerivation rec {
39 pname = "gwe";
40 version = "0.15.9";
41
42 src = fetchFromGitLab {
43 owner = "leinardi";
44 repo = pname;
45 rev = version;
46 hash = "sha256-agq967QN1nsAOn+1Ce64+id7UlSS/K3XGsUUihWOztk=";
47 };
48
49 prePatch = ''
50 patchShebangs scripts/{make_local_manifest,meson_post_install}.py
51
52 substituteInPlace gwe/repository/nvidia_repository.py \
53 --replace "from py3nvml import py3nvml" "import pynvml" \
54 --replace "py3nvml.py3nvml" "pynvml" \
55 --replace "py3nvml" "pynvml"
56 '';
57
58 nativeBuildInputs = [
59 wrapGAppsHook3
60 pkg-config
61 meson
62 ninja
63 cmake
64 gobject-introspection
65 desktop-file-utils
66 pythonEnv
67 ];
68
69 buildInputs = [
70 gtk3
71 libdazzle
72 libappindicator-gtk3
73 libnotify
74 ];
75
76 postInstall = ''
77 mv $out/bin/gwe $out/lib/gwe-bin
78
79 makeWrapper ${pythonEnv}/bin/python $out/bin/gwe \
80 --add-flags "$out/lib/gwe-bin" \
81 --prefix LD_LIBRARY_PATH : "/run/opengl-driver/lib" \
82 --prefix PATH : "${
83 builtins.concatStringsSep ":" [
84 (lib.makeBinPath [
85 nvidia_x11
86 nvidia_x11.settings
87 ])
88 "/run/wrappers/bin"
89 ]
90 }" \
91 --unset "SHELL" \
92 ''${gappsWrapperArgs[@]}
93 '';
94
95 meta = with lib; {
96 description = "System utility designed to provide information, control the fans and overclock your NVIDIA card";
97 homepage = "https://gitlab.com/leinardi/gwe";
98 platforms = platforms.linux;
99 license = licenses.gpl3Only;
100 maintainers = [ ];
101 mainProgram = "gwe";
102 };
103}