0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 21:50:33 +03:00

handheld-daemon: touchup code style to better match nixpkgs

Co-authored-by: h7x4 <h7x4@nani.wtf>
Co-authored-by: Luke Granger-Brown <git@lukegb.com>
Co-authored-by: Bruno BELANYI <bruno@belanyi.fr>
This commit is contained in:
Brenton Simpson 2024-01-22 11:12:04 -08:00
parent 3bfa7c5710
commit b960a217bd
2 changed files with 13 additions and 12 deletions

View file

@ -9,6 +9,7 @@ in
{ {
options.services.handheld-daemon = { options.services.handheld-daemon = {
enable = mkEnableOption "Enable Handheld Daemon"; enable = mkEnableOption "Enable Handheld Daemon";
package = mkPackageOption pkgs "handheld-daemon" { };
user = mkOption { user = mkOption {
type = types.str; type = types.str;
@ -19,9 +20,9 @@ in
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.handheld-daemon ]; environment.systemPackages = [ cfg.package ];
services.udev.packages = [ pkgs.handheld-daemon ]; services.udev.packages = [ cfg.package ];
systemd.packages = [ pkgs.handheld-daemon ]; systemd.packages = [ cfg.package ];
systemd.services.handheld-daemon = { systemd.services.handheld-daemon = {
description = "Handheld Daemon"; description = "Handheld Daemon";
@ -31,7 +32,7 @@ in
restartIfChanged = true; restartIfChanged = true;
serviceConfig = { serviceConfig = {
ExecStart = "${ pkgs.handheld-daemon }/bin/hhd --user ${ cfg.user }"; ExecStart = "${ lib.getExe cfg.package } --user ${ cfg.user }";
Nice = "-12"; Nice = "-12";
Restart = "on-failure"; Restart = "on-failure";
RestartSec = "10"; RestartSec = "10";

View file

@ -9,28 +9,28 @@
python3.pkgs.buildPythonApplication rec { python3.pkgs.buildPythonApplication rec {
pname = "handheld-daemon"; pname = "handheld-daemon";
version = "1.1.0"; version = "1.1.0";
format = "pyproject"; pyproject = true;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "hhd-dev"; owner = "hhd-dev";
repo = "hhd"; repo = "hhd";
rev = "abe34c6841476f5b41afe30ee18ff3e510402d68"; rev = "v${version}";
hash = "sha256-ovLC1BQ98jUaDEMPBzWma4TYSzTF+yE/cMemFdJmqlE="; hash = "sha256-ovLC1BQ98jUaDEMPBzWma4TYSzTF+yE/cMemFdJmqlE=";
}; };
pythonPath = with python3.pkgs; [
evdev
pyyaml
rich
];
propagatedBuildInputs = with python3.pkgs; [ propagatedBuildInputs = with python3.pkgs; [
evdev
hidapi hidapi
kmod kmod
pyyaml
rich
setuptools setuptools
toybox toybox
]; ];
# This package doesn't have upstream tests.
doCheck = false;
# handheld-daemon contains a fork of the python module `hid`, so this hook # handheld-daemon contains a fork of the python module `hid`, so this hook
# is borrowed from the `hid` derivation. # is borrowed from the `hid` derivation.
postPatch = '' postPatch = ''