Add usbrelay-firmware
modules/cogd/packages/firmware.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 firmware)) | |
| 6 | + | ||
| 7 | + | (use-modules (guix packages) | |
| 8 | + | (guix git-download) | |
| 9 | + | (guix gexp) | |
| 10 | + | (guix build-system gnu) | |
| 11 | + | ((guix licenses) #:prefix license:) | |
| 12 | + | (gnu packages avr)) | |
| 13 | + | ||
| 14 | + | (define-public usbrelay-firmware | |
| 15 | + | (package | |
| 16 | + | (name "usbrelay-firmware") | |
| 17 | + | (synopsis "USB relay board firmware") | |
| 18 | + | (description "Atmel AVR firmware for controlling relay board over USB.") | |
| 19 | + | (home-page "https://github.com/thmahe/usbrelay-firmware") | |
| 20 | + | (license license:gpl2) | |
| 21 | + | (version "1.0.0") | |
| 22 | + | (source | |
| 23 | + | (origin | |
| 24 | + | (method git-fetch) | |
| 25 | + | (uri (git-reference | |
| 26 | + | (url home-page) | |
| 27 | + | (commit (string-append "v" version)))) | |
| 28 | + | (file-name (git-file-name name version)) | |
| 29 | + | (sha256 | |
| 30 | + | (base32 "1wijr91vlra59rilxm1yk94fjsmvzdvf03f0m5lidymcgngxys1q")))) | |
| 31 | + | (build-system gnu-build-system) | |
| 32 | + | (native-inputs | |
| 33 | + | (list (origin | |
| 34 | + | (method git-fetch) | |
| 35 | + | (uri (git-reference | |
| 36 | + | (url "https://github.com/obdev/v-usb") | |
| 37 | + | (commit "7a28fdc685952412dad2b8842429127bc1cf9fa7"))) | |
| 38 | + | (sha256 (base32 "1339c6xisn5ys27qmyvw3snsq04xsz2alpfkq9xrnzmdih7zxlna"))) | |
| 39 | + | (make-avr-toolchain))) | |
| 40 | + | (arguments | |
| 41 | + | (list | |
| 42 | + | #:tests? #f | |
| 43 | + | #:phases | |
| 44 | + | #~(modify-phases %standard-phases | |
| 45 | + | (add-after 'unpack 'install-v-usb | |
| 46 | + | (lambda* (#:key inputs #:allow-other-keys) | |
| 47 | + | (let ((v-usb (dirname (search-input-directory inputs "v-usb.xcodeproj")))) | |
| 48 | + | (copy-recursively v-usb "submodules/v-usb")))) | |
| 49 | + | (delete 'configure) | |
| 50 | + | (replace 'build | |
| 51 | + | (lambda _ | |
| 52 | + | (invoke "make" "firmware"))) | |
| 53 | + | (replace 'install | |
| 54 | + | (lambda _ | |
| 55 | + | (let ((dir (string-append #$output "/share/firmware/usbrelay"))) | |
| 56 | + | (copy-recursively "build" dir))))))))) |