about summary refs log tree commit diff
path: root/pkgs/by-name/ha
diff options
context:
space:
mode:
authorLuke Granger-Brown <git@lukegb.com>2024-01-30 04:01:11 +0000
committerGitHub <noreply@github.com>2024-01-30 04:01:11 +0000
commita12b828a26dc12db12ddec20f94801d07758530a (patch)
tree4e8f69e978a520e84b56396adf73fd94bb706881 /pkgs/by-name/ha
parent630cc6b1cae6876cc894a5527e8acc2d58e31112 (diff)
parentb960a217bd351378b01a27f37df9d4b0028570b0 (diff)
downloadnixlib-a12b828a26dc12db12ddec20f94801d07758530a.tar
nixlib-a12b828a26dc12db12ddec20f94801d07758530a.tar.gz
nixlib-a12b828a26dc12db12ddec20f94801d07758530a.tar.bz2
nixlib-a12b828a26dc12db12ddec20f94801d07758530a.tar.lz
nixlib-a12b828a26dc12db12ddec20f94801d07758530a.tar.xz
nixlib-a12b828a26dc12db12ddec20f94801d07758530a.tar.zst
nixlib-a12b828a26dc12db12ddec20f94801d07758530a.zip
Merge pull request #277661 from appsforartists/handheld-daemon
handheld-daemon: init at 1.1.0
Diffstat (limited to 'pkgs/by-name/ha')
-rw-r--r--pkgs/by-name/ha/handheld-daemon/package.nix54
1 files changed, 54 insertions, 0 deletions
diff --git a/pkgs/by-name/ha/handheld-daemon/package.nix b/pkgs/by-name/ha/handheld-daemon/package.nix
new file mode 100644
index 000000000000..bb0c9d65bfe1
--- /dev/null
+++ b/pkgs/by-name/ha/handheld-daemon/package.nix
@@ -0,0 +1,54 @@
+{ config
+, fetchFromGitHub
+, hidapi
+, kmod
+, lib
+, python3
+, toybox
+}:
+python3.pkgs.buildPythonApplication rec {
+  pname = "handheld-daemon";
+  version = "1.1.0";
+  pyproject = true;
+
+  src = fetchFromGitHub {
+    owner = "hhd-dev";
+    repo = "hhd";
+    rev = "v${version}";
+    hash = "sha256-ovLC1BQ98jUaDEMPBzWma4TYSzTF+yE/cMemFdJmqlE=";
+  };
+
+  propagatedBuildInputs = with python3.pkgs; [
+    evdev
+    hidapi
+    kmod
+    pyyaml
+    rich
+    setuptools
+    toybox
+  ];
+
+  # This package doesn't have upstream tests.
+  doCheck = false;
+
+  # 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
+  '';
+
+  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;
+    maintainers = with maintainers; [ appsforartists ];
+    mainProgram = "hhd";
+  };
+}