1{ stdenv, lib, fetchFromGitHub, hidapi, installShellFiles }:
2stdenv.mkDerivation (finalAttrs: {
3 pname = "usbrelay";
4 version = "1.2.1";
5
6 src = fetchFromGitHub {
7 owner = "darrylb123";
8 repo = "usbrelay";
9 rev = finalAttrs.version;
10 sha256 = "sha256-9jEiMmBEpqY4+nKh3H8N/JrLohp/7oPK3rPmRjp2gvc=";
11 };
12
13 nativeBuildInputs = [
14 installShellFiles
15 ];
16
17 buildInputs = [
18 hidapi
19 ];
20
21 makeFlags = [
22 "DIR_VERSION=${finalAttrs.version}"
23 "PREFIX=${placeholder "out"}"
24 "LDCONFIG=${stdenv.cc.libc.bin}/bin/ldconfig"
25 ];
26
27 postInstall = ''
28 installManPage usbrelay.1
29 '';
30
31 meta = with lib; {
32 description = "Tool to control USB HID relays";
33 mainProgram = "usbrelay";
34 homepage = "https://github.com/darrylb123/usbrelay";
35 license = licenses.gpl2Plus;
36 maintainers = with maintainers; [ wentasah ];
37 platforms = platforms.linux;
38 };
39})