From 3d45f134ee89affdb1cfe393d11aab034c5dbd50 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Sat, 2 Oct 2021 19:59:38 +0200 Subject: [PATCH 1/2] gkraken: init at 1.1.6 --- pkgs/tools/system/gkraken/default.nix | 86 +++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 88 insertions(+) create mode 100644 pkgs/tools/system/gkraken/default.nix diff --git a/pkgs/tools/system/gkraken/default.nix b/pkgs/tools/system/gkraken/default.nix new file mode 100644 index 000000000000..9cd30e83c325 --- /dev/null +++ b/pkgs/tools/system/gkraken/default.nix @@ -0,0 +1,86 @@ +{ python3Packages +, lib +, fetchFromGitLab +, meson +, pkg-config +, glib +, ninja +, desktop-file-utils +, gobject-introspection +, gtk3 +, libnotify +, dbus +, wrapGAppsHook +}: + +python3Packages.buildPythonApplication rec { + pname = "gkraken"; + version = "1.1.6"; + + src = fetchFromGitLab { + owner = "leinardi"; + repo = "gkraken"; + rev = version; + sha256 = "085zz6m7c3xzsrvkw50gbbz8l9fmswxj2hjya2f52dvgs8daijdy"; + }; + + format = "other"; + + postPatch = '' + patchShebangs scripts/meson_post_install.py + ''; + + nativeBuildInputs = [ + meson + pkg-config + glib + ninja + gtk3 + desktop-file-utils + wrapGAppsHook + ]; + + buildInputs = [ + gobject-introspection + 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; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7fbbf150eee8..0051555c3e46 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5853,6 +5853,8 @@ with pkgs; gbenchmark = callPackage ../development/libraries/gbenchmark {}; + gkraken = callPackage ../tools/system/gkraken { }; + gtkdatabox = callPackage ../development/libraries/gtkdatabox {}; gtklick = callPackage ../applications/audio/gtklick {}; From bfd58f3cf3836274832d6c933d59911b1ab75a8f Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Sun, 3 Oct 2021 11:13:19 +0200 Subject: [PATCH 2/2] nixos/gkraken: init --- nixos/modules/hardware/gkraken.nix | 18 ++++++++++++++++++ nixos/modules/module-list.nix | 1 + 2 files changed, 19 insertions(+) create mode 100644 nixos/modules/hardware/gkraken.nix diff --git a/nixos/modules/hardware/gkraken.nix b/nixos/modules/hardware/gkraken.nix new file mode 100644 index 000000000000..97d15369db0a --- /dev/null +++ b/nixos/modules/hardware/gkraken.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.hardware.gkraken; +in +{ + options.hardware.gkraken = { + enable = mkEnableOption "gkraken's udev rules for NZXT AIO liquid coolers"; + }; + + config = mkIf cfg.enable { + services.udev.packages = with pkgs; [ + gkraken + ]; + }; +} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index bff7b83ea711..f5a6def4af95 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -48,6 +48,7 @@ ./hardware/corectrl.nix ./hardware/digitalbitbox.nix ./hardware/device-tree.nix + ./hardware/gkraken.nix ./hardware/i2c.nix ./hardware/sensor/hddtemp.nix ./hardware/sensor/iio.nix