Subject: [bug#42682] [PATCH v2 8/9] gnu: Add qmk-cli.

From: Fredrik Salomonsson <[email-masked]>
Date: Sun, 9 Apr 2023 04:31:15 +0000

* gnu/packages/hardware.scm (qmk-cli): New variable.
---
 gnu/packages/hardware.scm | 49 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/gnu/packages/hardware.scm b/gnu/packages/hardware.scm
index 299d7b96a1..1f8be61ca5 100644
--- a/gnu/packages/hardware.scm
+++ b/gnu/packages/hardware.scm
@@ -16,6 +16,7 @@
 ;;; Copyright © 2022 Maxim Cournoyer <[email-masked]>
 ;;; Copyright © 2022 Efraim Flashner <[email-masked]>
 ;;; Copyright © 2023 Spencer Skylar Chan <[email-masked]>
+;;; Copyright © 2023 Fredrik Salomonsson <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -76,6 +77,8 @@ (define-module (gnu packages hardware)
   #:use-module (gnu packages protobuf)
   #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-build)
+  #:use-module (gnu packages python-check)
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
@@ -90,10 +93,12 @@ (define-module (gnu packages hardware)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system glib-or-gtk)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system meson)
   #:use-module (guix build-system perl)
+  #:use-module (guix build-system pyproject)
   #:use-module (guix build-system python)
   #:use-module (guix download)
   #:use-module (guix gexp)
@@ -1359,3 +1364,47 @@ (define-public libcpuid
 string, code name and other information from x86 CPU. This library is not to be
 confused with the @code{cpuid} command line utility from package @code{cpuid}.")
       (license license:bsd-2))))
+
+(define-public qmk-cli
+  (package
+    (name "qmk-cli")
+    (version "1.1.2")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "qmk" version))
+              (sha256
+               (base32
+                "1619q9v90740dbg8xpzqlhwcasz42xj737803aiip8qc3a7zhwgq"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list #:tests? #f)) ; test removed in pypi
+    (inputs
+     (list
+      python-hid
+      python-hjson
+      python-jsonschema-next
+      python-milc
+      python-pillow
+      python-pygments
+      python-pyserial
+      python-pyusb
+      python-dotty-dict
+      python-tox
+      python-wheel))
+    (home-page "https://qmk.fm")
+    (synopsis "Program to help users work with QMK Firmware")
+    (description
+     "This package provides a @acronym{CLI, command line interface} based
+program to help users work with QMK Firmware.  Where QMK Firmware is
+an open firmware for custom keyboards, e.g. Planck, ErgoDox, Corne and
+many more.  This @acronym{CLI} program is mainly used for building the
+QMK firmware, but also has some other convenience utilities.  To be
+able to build a firmware also include the following packages:
+@code{avr-toolchain} and either @code{dfu-programmer} or
+@code{avrdude} depending on what microcontroller(s) is/are used for
+the keyboard.  To be able to clone the QMK Firmware project using
+@command{qmk clone} include the @code{git} package.  It is highly
+recommended to setup udev rules to avoid running this as root when
+flashing the firmware, see @code{qmk-udev-rules} and
+@code{udev-service-type}.")
+    (license license:expat)))
-- 
2.39.2