Subject: [PATCH v3 8/9] gnu: Add qmk-cli.

From: Fredrik Salomonsson <[email-masked]>
Date: Sun, 28 May 2023 23:44:06 +0000

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

diff --git a/gnu/packages/hardware.scm b/gnu/packages/hardware.scm
index c23299d1db..ebf5f47e1a 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.
 ;;;
@@ -79,6 +80,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)
@@ -94,10 +97,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)
@@ -1438,3 +1443,45 @@ (define-public lxi-tools
 on the LXI Consortium standard which defines the communication protocols for
 modern instrumentation and data acquision systems using Ethernet.")
     (license license:bsd-3)))
+
+(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
+      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.40.1