about summary refs log tree commit diff
path: root/pkgs/tools/system/gkraken/default.nix
blob: 9866c049fa7aaa097620cf372448d95794fd4039 (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
{ python3Packages
, lib
, fetchFromGitLab
, meson
, pkg-config
, glib
, ninja
, desktop-file-utils
, gobject-introspection
, gtk3
, libnotify
, dbus
, wrapGAppsHook3
}:

python3Packages.buildPythonApplication rec {
  pname = "gkraken";
  version = "1.2.0";

  src = fetchFromGitLab {
    owner = "leinardi";
    repo = "gkraken";
    rev = version;
    sha256 = "0hxlh0319rl28iba02917z3n6d5cq2qcgpj2ng31bkjjhlvvfm2g";
  };

  format = "other";

  postPatch = ''
    patchShebangs scripts/meson_post_install.py
  '';

  nativeBuildInputs = [
    meson
    pkg-config
    gobject-introspection
    glib
    ninja
    gtk3
    desktop-file-utils
    wrapGAppsHook3
  ];

  buildInputs = [
    glib
    gtk3
    libnotify
    dbus
  ];

  propagatedBuildInputs = with python3Packages; [
    pygobject3
    peewee
    rx
    injector
    liquidctl
    pyxdg
    requests
    matplotlib
    dbus-python
  ];

  dontWrapGApps = true;

  # Extract udev rules from python code
  postInstall = ''
    mkdir -p $out/lib/udev/rules.d
    sed -e '/\s*\(from\|@singleton\|@inject\)/d' $src/gkraken/interactor/udev_interactor.py > udev_interactor.py
    python -c 'from udev_interactor import _UDEV_RULE; print(_UDEV_RULE)' > $out/lib/udev/rules.d/60-gkraken.rules
  '';

  preFixup = ''
    makeWrapperArgs+=(
      "''${gappsWrapperArgs[@]}"
    )
  '';

  meta = with lib; {
    description = "GUI that allows to control the cooling (fan and/or pump profiles) of NZXT Kraken AIO liquid coolers from Linux";
    homepage = "https://gitlab.com/leinardi/gkraken";
    changelog = "https://gitlab.com/leinardi/gkraken/-/tags/${version}";
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [ OPNA2608 ];
    platforms = platforms.linux;
    mainProgram = "gkraken";
  };
}