From c94ae7a159eb8cd86f46ca1ea81dbdca651510f4 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Tue, 3 Dec 2024 08:47:26 +0100 Subject: [PATCH 1/2] handheld-daemon: 3.6.1 -> 3.6.2 Diff: https://github.com/hhd-dev/hhd/compare/refs/tags/v3.6.1...v3.6.2 Changelog: https://github.com/hhd-dev/hhd/releases/tag/v3.6.2 --- pkgs/by-name/ha/handheld-daemon/package.nix | 87 ++++++++++++++------- 1 file changed, 57 insertions(+), 30 deletions(-) diff --git a/pkgs/by-name/ha/handheld-daemon/package.nix b/pkgs/by-name/ha/handheld-daemon/package.nix index b99cd1c581476..6b5965e06e645 100644 --- a/pkgs/by-name/ha/handheld-daemon/package.nix +++ b/pkgs/by-name/ha/handheld-daemon/package.nix @@ -1,63 +1,90 @@ { + lib, + python3Packages, fetchFromGitHub, + + # dependencies + systemd, hidapi, + coreutils, kmod, - lib, - python3, - toybox, - lsof + dbus, + lsof, }: -python3.pkgs.buildPythonApplication rec { +python3Packages.buildPythonApplication rec { pname = "handheld-daemon"; - version = "3.6.1"; + version = "3.6.2"; pyproject = true; src = fetchFromGitHub { owner = "hhd-dev"; repo = "hhd"; - rev = "refs/tags/v${version}"; - hash = "sha256-IdpSRb66G+WzTv/BC29r2OjO1b4VdWbV6OSzOoiFAO0="; + tag = "v${version}"; + hash = "sha256-W1Ap6yTryBDozKe3aO413Fu0RBul9kEA9ACUTdYyOKM="; }; - propagatedBuildInputs = with python3.pkgs; [ + # This package relies on several programs expected to be on the user's PATH. + # We take a more reproducible approach by patching the absolute path to each of these required + # binaries. + postPatch = '' + substituteInPlace src/hhd/controller/lib/hid.py \ + --replace-fail "libhidapi" "${lib.getLib hidapi}/lib/libhidapi" + + substituteInPlace src/hhd/controller/lib/hide.py \ + --replace-fail "/bin/chmod" "${lib.getExe' coreutils "chmod"}" \ + --replace-fail "udevadm" "${lib.getExe' systemd "udevadm"}" + + substituteInPlace src/hhd/controller/physical/evdev.py \ + --replace-fail "udevadm" "${lib.getExe' systemd "udevadm"}" + + substituteInPlace src/hhd/controller/physical/imu.py \ + --replace-fail '"modprobe' '"${lib.getExe' kmod "modprobe"}' + + substituteInPlace src/hhd/device/oxp/serial.py \ + --replace-fail "udevadm" "${lib.getExe' systemd "udevadm"}" + + substituteInPlace src/hhd/plugins/overlay/systemd.py \ + --replace-fail "dbus-monitor" "${lib.getExe' dbus "dbus-monitor"}" \ + --replace-fail "systemd-inhibit" "${lib.getExe' systemd "systemd-inhibit"}" + + substituteInPlace src/hhd/plugins/overlay/x11.py \ + --replace-fail "lsof" "${lib.getExe lsof}" + + substituteInPlace src/hhd/plugins/plugin.py \ + --replace-fail '"id"' '"${lib.getExe' coreutils "id"}"' + ''; + + build-system = with python3Packages; [ + setuptools + ]; + + dependencies = with python3Packages; [ evdev - hidapi - kmod + pyserial pyyaml rich setuptools - toybox xlib - pyserial - lsof ]; # This package doesn't have upstream tests. doCheck = false; - postPatch = '' - # handheld-daemon contains a fork of the python module `hid`, so this hook - # is borrowed from the `hid` derivation. - hidapi=${hidapi}/lib/ - test -d $hidapi || { echo "ERROR: $hidapi doesn't exist, please update/fix this build expression."; exit 1; } - sed -i -e "s|libhidapi|$hidapi/libhidapi|" src/hhd/controller/lib/hid.py - - # The generated udev rules point to /bin/chmod, which does not exist in NixOS - chmod=${toybox}/bin/chmod - sed -i -e "s|/bin/chmod|$chmod|" src/hhd/controller/lib/hide.py - ''; - postInstall = '' install -Dm644 $src/usr/lib/udev/rules.d/83-hhd.rules -t $out/lib/udev/rules.d/ install -Dm644 $src/usr/lib/udev/hwdb.d/83-hhd.hwdb -t $out/lib/udev/hwdb.d/ ''; - meta = with lib; { + meta = { homepage = "https://github.com/hhd-dev/hhd/"; description = "Linux support for handheld gaming devices like the Legion Go, ROG Ally, and GPD Win"; - platforms = platforms.linux; - license = licenses.mit; - maintainers = with maintainers; [ appsforartists toast ]; + platforms = lib.platforms.linux; + changelog = "https://github.com/hhd-dev/hhd/releases/tag/v${version}"; + license = lib.licenses.gpl3Only; + maintainers = with lib.maintainers; [ + appsforartists + toast + ]; mainProgram = "hhd"; }; } From 2cf68f2bf37655d730202f2e551b40172181801c Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Mon, 9 Dec 2024 10:26:53 +0100 Subject: [PATCH 2/2] handheld-daemon: 3.6.2 -> 3.7.0 Diff: https://github.com/hhd-dev/hhd/compare/None...v3.7.0 Changelog: https://github.com/hhd-dev/hhd/releases/tag/v3.7.0 --- pkgs/by-name/ha/handheld-daemon/package.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/ha/handheld-daemon/package.nix b/pkgs/by-name/ha/handheld-daemon/package.nix index 6b5965e06e645..2fe0c45eca77f 100644 --- a/pkgs/by-name/ha/handheld-daemon/package.nix +++ b/pkgs/by-name/ha/handheld-daemon/package.nix @@ -8,19 +8,20 @@ hidapi, coreutils, kmod, + efibootmgr, dbus, lsof, }: python3Packages.buildPythonApplication rec { pname = "handheld-daemon"; - version = "3.6.2"; + version = "3.7.0"; pyproject = true; src = fetchFromGitHub { owner = "hhd-dev"; repo = "hhd"; tag = "v${version}"; - hash = "sha256-W1Ap6yTryBDozKe3aO413Fu0RBul9kEA9ACUTdYyOKM="; + hash = "sha256-DkVdYnSEeaNZj76lhdU+9Pl0yzam2A2QGa3aHCmSHEA="; }; # This package relies on several programs expected to be on the user's PATH. @@ -40,6 +41,9 @@ python3Packages.buildPythonApplication rec { substituteInPlace src/hhd/controller/physical/imu.py \ --replace-fail '"modprobe' '"${lib.getExe' kmod "modprobe"}' + substituteInPlace src/hhd/plugins/overlay/power.py \ + --replace-fail '"efibootmgr"' '"${lib.getExe' efibootmgr "id"}"' + substituteInPlace src/hhd/device/oxp/serial.py \ --replace-fail "udevadm" "${lib.getExe' systemd "udevadm"}"