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