Subject: [bug#42682] [PATCH 2/2] gnu: Add qmk-cli.

From: Jan Wielkiewicz <[email-masked]>
Date: Sun, 2 Aug 2020 22:49:10 +0200

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

diff --git a/gnu/packages/hardware.scm b/gnu/packages/hardware.scm
index 211a5a34ac..adab986d75 100644
--- a/gnu/packages/hardware.scm
+++ b/gnu/packages/hardware.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <[email-masked]>
 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <[email-masked]>
 ;;; Copyright © 2020 Brice Waegeneire <[email-masked]>
+;;; Copyright © 2020 Jan Wielkiewicz <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -19,6 +20,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages hardware)
+  #:use-module (gnu packages avr)
   #:use-module (gnu packages admin)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages bash)
@@ -27,6 +29,8 @@
   #:use-module (gnu packages cpp)
   #:use-module (gnu packages crypto)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages embedded)
+  #:use-module (gnu packages flashing-tools)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages libusb)
@@ -36,10 +40,14 @@
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages polkit)
   #:use-module (gnu packages protobuf)
+  #:use-module (gnu packages python)
+  #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages version-control)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system python)
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module ((guix licenses) #:prefix license:)
@@ -465,3 +473,45 @@ authorization policies (what kind of USB devices are authorized) as well as
 method of use policies (how a USB device may interact with the system).
 Simply put, it is a USB device whitelisting tool.")
     (license license:gpl2)))
+
+(define-public qmk-cli
+  (package
+    (name "qmk-cli")
+    (version "0.0.35")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "qmk" version))
+       (sha256
+        (base32
+         "1dd3q38r5bs9ih8jiwsb7q2655wyka2a8wlwv7yln9narlqwl177"))))
+    (build-system python-build-system)
+    (propagated-inputs
+     `(("arm-none-eabi-gcc" ,gcc-arm-none-eabi-7-2018-q2-update)
+       ("avr-gcc" ,avr-toolchain-5)
+       ("avrdude" ,avrdude)
+       ("dfu-programmer" ,dfu-programmer)
+       ("dfu-util" ,dfu-util)
+       ("git" ,git)
+       ("python3" ,python)
+       ("python-appdirs" ,python-appdirs)
+       ("python-argcomplete" ,python-argcomplete)
+       ("python-colorama" ,python-colorama)
+       ("python-flake8" ,python-flake8)
+       ("python-hjson" ,python-hjson)
+       ("python-nose2" ,python-nose2)
+       ("python-yapf" ,python-yapf)))
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (add-before 'check 'set-qmk-home
+                    (lambda _
+                      ;; tests fail without this variable set
+                      (setenv "QMK_HOME"
+                              "")
+                      #t)))))
+    (home-page "https://github.com/qmk/qmk_cli")
+    (synopsis
+     "Tools for developing QMK Firmware")
+    (description
+     "A program to help users work with QMK Firmware.")
+    (license license:expat)))
-- 
2.28.0