Unverified Commit bb1e65a8 authored by Nick Cao's avatar Nick Cao Committed by GitHub
Browse files

Merge pull request #303846 from toast003/update-hhd

handheld-daemon: 1.1.0 -> 2.6.4
parents 217dd89e d9b487ae
Loading
Loading
Loading
Loading
+18 −12
Original line number Diff line number Diff line
{ config
, fetchFromGitHub
, hidapi
, kmod
, lib
, python3
, toybox
{
  config,
  fetchFromGitHub,
  hidapi,
  kmod,
  lib,
  python3,
  toybox,
}:
python3.pkgs.buildPythonApplication rec {
  pname = "handheld-daemon";
  version = "1.1.0";
  version = "2.6.4";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "hhd-dev";
    repo = "hhd";
    rev = "v${version}";
    hash = "sha256-ovLC1BQ98jUaDEMPBzWma4TYSzTF+yE/cMemFdJmqlE=";
    hash = "sha256-S77APtE1GGfqnv1IkZdJOSlprPOBtrqVXV60yVMvopg=";
  };

  propagatedBuildInputs = with python3.pkgs; [
@@ -26,17 +27,22 @@ python3.pkgs.buildPythonApplication rec {
    rich
    setuptools
    toybox
    xlib
  ];

  # 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.
  postPatch = ''
    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 = ''