From 0b197aca6d8a48ac553b70638d6bebca7cd40b8a Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Mon, 16 Dec 2024 06:33:45 +0300 Subject: [PATCH] Max: Add wm2fc. --- host/x86_64-linux/max/Fan.nix | 19 +++++++++++++++++++ package/wm2fc/default.nix | 28 ++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 host/x86_64-linux/max/Fan.nix create mode 100644 package/wm2fc/default.nix diff --git a/host/x86_64-linux/max/Fan.nix b/host/x86_64-linux/max/Fan.nix new file mode 100644 index 00000000..c8c23a79 --- /dev/null +++ b/host/x86_64-linux/max/Fan.nix @@ -0,0 +1,19 @@ +{ + __findFile, + pkgs, + ... +}: let + wm2fc = pkgs.callPackage {}; +in { + environment.systemPackages = with pkgs; [ + wm2fc + ]; + + security.wrappers.wm2fc = { + source = "${wm2fc}/bin/wm2fc"; + owner = "root"; + group = "root"; + setuid = true; + permissions = "u+rx,g+x,o+x"; + }; +} diff --git a/package/wm2fc/default.nix b/package/wm2fc/default.nix new file mode 100644 index 00000000..c55a13a4 --- /dev/null +++ b/package/wm2fc/default.nix @@ -0,0 +1,28 @@ +# SRC: https://github.com/matega/win-max-2-fan-control +{ + autoPatchelfHook, + fetchFromGitHub, + lib, + stdenv, +}: stdenv.mkDerivation { + # dontUnpack = true; + name = "wm2fc"; + src = fetchFromGitHub { + hash = "sha256-rU0n+4glTWHWjbvbc7Se0O53g1mVDwBP5SkH4ftwNWk="; + owner = "matega"; + repo = "win-max-2-fan-control"; + rev = "a9e65011e0b45d0a76fc5307ad2b7b585410dece"; + }; + installPhase = '' + runHook preInstall + install -Dm755 dist/Debug/GNU-Linux/winmax2fancontrol $out/bin/wm2fc + runHook postInstall + ''; + meta = with lib; { + description = "GPD Win Max 2 Fan Control PoC"; + license = licenses.gpl3; + mainProgram = "wm2fc"; + meta.platforms = platforms.all; + }; +} +