usbrelay: 1.0 -> 1.0.1

This commit is contained in:
Michal Sojka 2022-09-16 22:19:18 +00:00
parent da6a05816e
commit ec026d26d2
5 changed files with 11 additions and 7 deletions

View file

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

View file

@ -1,4 +1,4 @@
{ stdenv, usbrelay, python3 }:
{ stdenv, usbrelay, python3, installShellFiles }:
let
python = python3.withPackages (ps: with ps; [ usbrelay-py paho-mqtt ]);
in
@ -16,6 +16,8 @@ stdenv.mkDerivation rec {
--replace '/usr/sbin/usbrelayd' "$out/bin/usbrelayd"
'';
nativeBuildInputs = [ installShellFiles ];
buildInputs = [ python ];
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 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
installManPage usbrelayd.8
runHook postInstall
'';

View file

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

View file

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

View file

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