tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
usbrelay: 1.0 -> 1.0.1
Michal Sojka
3 years ago
ec026d26
da6a0581
+11
-7
5 changed files
expand all
collapse all
unified
split
nixos
modules
services
hardware
usbrelayd.nix
pkgs
os-specific
linux
usbrelay
daemon.nix
default.nix
python.nix
test.nix
-4
nixos/modules/services/hardware/usbrelayd.nix
···
34
34
35
35
services.udev.packages = [ pkgs.usbrelayd ];
36
36
systemd.packages = [ pkgs.usbrelayd ];
37
37
-
users.users.usbrelay = {
38
38
-
isSystemUser = true;
39
39
-
group = "usbrelay";
40
40
-
};
41
37
users.groups.usbrelay = { };
42
38
};
43
39
+4
-1
pkgs/os-specific/linux/usbrelay/daemon.nix
···
1
1
-
{ stdenv, usbrelay, python3 }:
1
1
+
{ stdenv, usbrelay, python3, installShellFiles }:
2
2
let
3
3
python = python3.withPackages (ps: with ps; [ usbrelay-py paho-mqtt ]);
4
4
in
···
16
16
--replace '/usr/sbin/usbrelayd' "$out/bin/usbrelayd"
17
17
'';
18
18
19
19
+
nativeBuildInputs = [ installShellFiles ];
20
20
+
19
21
buildInputs = [ python ];
20
22
21
23
dontBuild = true;
···
26
28
install -m 644 -D usbrelayd.service $out/lib/systemd/system/usbrelayd.service
27
29
install -m 644 -D 50-usbrelay.rules $out/lib/udev/rules.d/50-usbrelay.rules
28
30
install -m 644 -D usbrelayd.conf $out/etc/usbrelayd.conf # include this as an example
31
31
+
installManPage usbrelayd.8
29
32
runHook postInstall
30
33
'';
31
34
+2
-2
pkgs/os-specific/linux/usbrelay/default.nix
···
1
1
{ stdenv, lib, fetchFromGitHub, hidapi, installShellFiles }:
2
2
stdenv.mkDerivation rec {
3
3
pname = "usbrelay";
4
4
-
version = "1.0";
4
4
+
version = "1.0.1";
5
5
6
6
src = fetchFromGitHub {
7
7
owner = "darrylb123";
8
8
repo = "usbrelay";
9
9
rev = version;
10
10
-
sha256 = "sha256-5zgpN4a+r0tmw0ISTJM+d9mo+L/qwUvpWPSsykuG0cg=";
10
10
+
sha256 = "sha256-2elDrO+WaaRYdTrG40Ez00qSsNVQjXE6GdOJbWPfugE=";
11
11
};
12
12
13
13
nativeBuildInputs = [
+4
pkgs/os-specific/linux/usbrelay/python.nix
···
4
4
pname = "usbrelay_py";
5
5
inherit (usbrelay) version src;
6
6
7
7
+
preConfigure = ''
8
8
+
cd usbrelay_py
9
9
+
'';
10
10
+
7
11
buildInputs = [ usbrelay ];
8
12
9
13
pythonImportsCheck = [ "usbrelay_py" ];
+1
pkgs/os-specific/linux/usbrelay/test.nix
···
42
42
};
43
43
44
44
testScript = ''
45
45
+
import os
45
46
if os.waitstatus_to_exitcode(os.system("lsusb -d 16c0:05df")) != 0:
46
47
print("No USB relay detected, skipping test")
47
48
import sys