2024-04-21 15:54:59 +00:00
|
|
|
{
|
|
|
|
fetchFromGitHub,
|
|
|
|
hidapi,
|
|
|
|
kmod,
|
|
|
|
lib,
|
|
|
|
python3,
|
|
|
|
toybox,
|
2024-02-07 01:22:34 +00:00
|
|
|
}:
|
|
|
|
python3.pkgs.buildPythonApplication rec {
|
|
|
|
pname = "handheld-daemon";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "3.3.15";
|
2024-02-07 01:22:34 +00:00
|
|
|
pyproject = true;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "hhd-dev";
|
|
|
|
repo = "hhd";
|
2024-07-27 06:49:29 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-NniHOxe77hBHn81pVtlaSeIK+Hp+Lw3xBHolO6Acbho=";
|
2024-02-07 01:22:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = with python3.pkgs; [
|
|
|
|
evdev
|
|
|
|
hidapi
|
|
|
|
kmod
|
|
|
|
pyyaml
|
|
|
|
rich
|
|
|
|
setuptools
|
|
|
|
toybox
|
2024-04-21 15:54:59 +00:00
|
|
|
xlib
|
2024-02-07 01:22:34 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
# This package doesn't have upstream tests.
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
postPatch = ''
|
2024-04-21 15:54:59 +00:00
|
|
|
# handheld-daemon contains a fork of the python module `hid`, so this hook
|
|
|
|
# is borrowed from the `hid` derivation.
|
|
|
|
hidapi=${hidapi}/lib/
|
2024-02-07 01:22:34 +00:00
|
|
|
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
|
2024-04-21 15:54:59 +00:00
|
|
|
|
|
|
|
# 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
|
2024-02-07 01:22:34 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
install -Dm644 $src/usr/lib/udev/rules.d/83-hhd.rules -t $out/lib/udev/rules.d/
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
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;
|
2024-04-21 15:54:59 +00:00
|
|
|
maintainers = with maintainers; [ appsforartists toast ];
|
2024-02-07 01:22:34 +00:00
|
|
|
mainProgram = "hhd";
|
|
|
|
};
|
|
|
|
}
|