Merge pull request #191851 from wentasah/usbrelay-1.0.1

usbrelay: 1.0 -> 1.0.1
This commit is contained in:
Jonas Heinrich 2022-09-20 12:23:36 +02:00 committed by GitHub
commit 77984dedc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 7 deletions

View File

@ -34,10 +34,6 @@ in
services.udev.packages = [ pkgs.usbrelayd ]; services.udev.packages = [ pkgs.usbrelayd ];
systemd.packages = [ pkgs.usbrelayd ]; systemd.packages = [ pkgs.usbrelayd ];
users.users.usbrelay = {
isSystemUser = true;
group = "usbrelay";
};
users.groups.usbrelay = { }; users.groups.usbrelay = { };
}; };

View File

@ -1,4 +1,4 @@
{ stdenv, usbrelay, python3 }: { stdenv, usbrelay, python3, installShellFiles }:
let let
python = python3.withPackages (ps: with ps; [ usbrelay-py paho-mqtt ]); python = python3.withPackages (ps: with ps; [ usbrelay-py paho-mqtt ]);
in in
@ -16,6 +16,8 @@ stdenv.mkDerivation rec {
--replace '/usr/sbin/usbrelayd' "$out/bin/usbrelayd" --replace '/usr/sbin/usbrelayd' "$out/bin/usbrelayd"
''; '';
nativeBuildInputs = [ installShellFiles ];
buildInputs = [ python ]; buildInputs = [ python ];
dontBuild = true; dontBuild = true;
@ -26,6 +28,7 @@ stdenv.mkDerivation rec {
install -m 644 -D usbrelayd.service $out/lib/systemd/system/usbrelayd.service install -m 644 -D usbrelayd.service $out/lib/systemd/system/usbrelayd.service
install -m 644 -D 50-usbrelay.rules $out/lib/udev/rules.d/50-usbrelay.rules install -m 644 -D 50-usbrelay.rules $out/lib/udev/rules.d/50-usbrelay.rules
install -m 644 -D usbrelayd.conf $out/etc/usbrelayd.conf # include this as an example install -m 644 -D usbrelayd.conf $out/etc/usbrelayd.conf # include this as an example
installManPage usbrelayd.8
runHook postInstall runHook postInstall
''; '';

View File

@ -1,13 +1,13 @@
{ stdenv, lib, fetchFromGitHub, hidapi, installShellFiles }: { stdenv, lib, fetchFromGitHub, hidapi, installShellFiles }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "usbrelay"; pname = "usbrelay";
version = "1.0"; version = "1.0.1";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "darrylb123"; owner = "darrylb123";
repo = "usbrelay"; repo = "usbrelay";
rev = version; rev = version;
sha256 = "sha256-5zgpN4a+r0tmw0ISTJM+d9mo+L/qwUvpWPSsykuG0cg="; sha256 = "sha256-2elDrO+WaaRYdTrG40Ez00qSsNVQjXE6GdOJbWPfugE=";
}; };
nativeBuildInputs = [ nativeBuildInputs = [

View File

@ -4,6 +4,10 @@ buildPythonPackage rec {
pname = "usbrelay_py"; pname = "usbrelay_py";
inherit (usbrelay) version src; inherit (usbrelay) version src;
preConfigure = ''
cd usbrelay_py
'';
buildInputs = [ usbrelay ]; buildInputs = [ usbrelay ];
pythonImportsCheck = [ "usbrelay_py" ]; pythonImportsCheck = [ "usbrelay_py" ];

View File

@ -42,6 +42,7 @@ import ../../../../nixos/tests/make-test-python.nix ({ pkgs, ... }: {
}; };
testScript = '' testScript = ''
import os
if os.waitstatus_to_exitcode(os.system("lsusb -d 16c0:05df")) != 0: if os.waitstatus_to_exitcode(os.system("lsusb -d 16c0:05df")) != 0:
print("No USB relay detected, skipping test") print("No USB relay detected, skipping test")
import sys import sys