Add python-usbrelay
modules/cogd/packages/hardware.scm unknown status 1
| 1 | + | ;;; SPDX-FileCopyrightText: 2025 Evgeny Pisemsky <mail@pisemsky.site> | |
| 2 | + | ;;; | |
| 3 | + | ;;; SPDX-License-Identifier: GPL-3.0-or-later | |
| 4 | + | ||
| 5 | + | (define-module (cogd packages hardware)) | |
| 6 | + | ||
| 7 | + | (use-modules (guix packages) | |
| 8 | + | (guix gexp) | |
| 9 | + | (guix build-system python) | |
| 10 | + | ((gnu packages hardware) #:prefix guix:) | |
| 11 | + | (gnu packages messaging)) | |
| 12 | + | ||
| 13 | + | (define-public python-usbrelay | |
| 14 | + | (package | |
| 15 | + | (inherit guix:usbrelay) | |
| 16 | + | (name "python-usbrelay") | |
| 17 | + | (build-system python-build-system) | |
| 18 | + | (inputs (list guix:usbrelay)) | |
| 19 | + | (propagated-inputs (list python-paho-mqtt)) | |
| 20 | + | (arguments | |
| 21 | + | (list | |
| 22 | + | #:phases #~(modify-phases %standard-phases | |
| 23 | + | (add-after 'unpack 'install-daemon | |
| 24 | + | (lambda _ | |
| 25 | + | (install-file "usbrelayd.8" | |
| 26 | + | (string-append #$output "/share/man/man8")) | |
| 27 | + | (install-file "usbrelayd" | |
| 28 | + | (string-append #$output "/sbin")) | |
| 29 | + | (chmod (string-append #$output "/sbin/usbrelayd") #o555))) | |
| 30 | + | (add-after 'install-daemon 'chdir-and-set-version | |
| 31 | + | (lambda _ | |
| 32 | + | (chdir "usbrelay_py") | |
| 33 | + | (substitute* "setup.py" | |
| 34 | + | ((" version = .*") | |
| 35 | + | (string-append " version = '" | |
| 36 | + | #$(package-version guix:usbrelay) "',\n"))) | |
| 37 | + | (substitute* "src/__init__.py" | |
| 38 | + | (("__version__ = .*") | |
| 39 | + | (string-append "__version__ = \"" | |
| 40 | + | #$(package-version guix:usbrelay) "\"\n")))))))))) |