mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 00:43:20 +00:00
Merge pull request #277661 from appsforartists/handheld-daemon
handheld-daemon: init at 1.1.0
This commit is contained in:
commit
a12b828a26
@ -38,6 +38,8 @@ In addition to numerous new and upgraded packages, this release has the followin
|
||||
|
||||
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
|
||||
|
||||
- [Handheld Daemon](https://github.com/hhd-dev/hhd), support for gaming handhelds like the Legion Go, ROG Ally, and GPD Win. Available as [services.handheld-daemon](#opt-services.handheld-daemon.enable).
|
||||
|
||||
- [Guix](https://guix.gnu.org), a functional package manager inspired by Nix. Available as [services.guix](#opt-services.guix.enable).
|
||||
|
||||
- [maubot](https://github.com/maubot/maubot), a plugin-based Matrix bot framework. Available as [services.maubot](#opt-services.maubot.enable).
|
||||
|
@ -534,6 +534,7 @@
|
||||
./services/hardware/fancontrol.nix
|
||||
./services/hardware/freefall.nix
|
||||
./services/hardware/fwupd.nix
|
||||
./services/hardware/handheld-daemon.nix
|
||||
./services/hardware/hddfancontrol.nix
|
||||
./services/hardware/illum.nix
|
||||
./services/hardware/interception-tools.nix
|
||||
|
44
nixos/modules/services/hardware/handheld-daemon.nix
Normal file
44
nixos/modules/services/hardware/handheld-daemon.nix
Normal file
@ -0,0 +1,44 @@
|
||||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.services.handheld-daemon;
|
||||
in
|
||||
{
|
||||
options.services.handheld-daemon = {
|
||||
enable = mkEnableOption "Enable Handheld Daemon";
|
||||
package = mkPackageOption pkgs "handheld-daemon" { };
|
||||
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
description = lib.mdDoc ''
|
||||
The user to run Handheld Daemon with.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
services.udev.packages = [ cfg.package ];
|
||||
systemd.packages = [ cfg.package ];
|
||||
|
||||
systemd.services.handheld-daemon = {
|
||||
description = "Handheld Daemon";
|
||||
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
restartIfChanged = true;
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = "${ lib.getExe cfg.package } --user ${ cfg.user }";
|
||||
Nice = "-12";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "10";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
meta.maintainers = [ maintainers.appsforartists ];
|
||||
}
|
54
pkgs/by-name/ha/handheld-daemon/package.nix
Normal file
54
pkgs/by-name/ha/handheld-daemon/package.nix
Normal file
@ -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";
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user