--- Begin Message ---
Subject: |
[PATCH] gnu: qmk: Support custom keyboards. |
Date: |
Wed, 29 Nov 2023 21:32:12 +0100 |
* gnu/packages/firmware.scm (make-qmk-firmware/implementation):
Add keyboard-source-directory parameter.
---
gnu/packages/firmware.scm | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index 294bbea184..e06b321cde 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -1406,14 +1406,16 @@ (define-public qmk
(define* (make-qmk-firmware/implementation keyboard keymap
#:key (description "")
keymap-json
- keymap-source-directory)
+ keymap-source-directory
+ keyboard-source-directory)
"Return a package to build the QMK firmware for KEYBOARD with KEYMAP.
-Keyboard should be the name of a sub-directory under the @file{keyboards}
-directory. For custom keymaps, KEYMAP-JSON, a file-like object of a JSON
-representation of KEYMAP as generated by the @url{https://config.qmk.fm/, QMK
-Configurator} tool or KEYMAP-SOURCE-DIRECTORY, a file-like object directory
-containing the keymap source files files such as @file{keymap.c}, can be
-provided."
+Keyboard should be the name of a sub-directory under the @file{keyboards}
directory.
+For custom keymaps, KEYMAP-JSON, a file-like object of a JSON representation of
+KEYMAP as generated by the @url{https://config.qmk.fm/, QMK Configurator} tool
or
+KEYMAP-SOURCE-DIRECTORY, a file-like object directory containing the keymap
source
+files files such as @file{keymap.c}, can be provided. For keyboards not
available in
+upstream repository, provide a file-like object directory containing the whole
+keyboard definition in KEYBOARD-SOURCE-DIRECTORY."
(package
(name (string-append "qmk-firmware-"
(string-replace-substring keyboard "_" "-") "-"
@@ -1472,6 +1474,15 @@ (define* (make-qmk-firmware/implementation keyboard
keymap
(base32
"1rmhm4rxvq8skxqn6vc4n4ly1ak6whj7c386zbsci4pxx548n9h4"))))
"lib/lufa")))
+ #$@(if keyboard-source-directory
+ #~((add-after 'unpack 'copy-keyboard-source-directory
+ (lambda _
+ (let ((keyboard-dir #$(string-append "keyboards/"
keyboard)))
+ (false-if-exception (delete-file-recursively
+ keyboard-dir))
+ (copy-recursively #$keyboard-source-directory
+ keyboard-dir)))))
+ #~())
#$@(if keymap-source-directory
#~((add-after 'unpack 'copy-keymap-source-directory
(lambda _
base-commit: cd46757c1a0f886848fbb6828c028dd2a2532767
--
2.41.0
--- End Message ---
--- Begin Message ---
Subject: |
Re: Requesting review |
Date: |
Sun, 31 Mar 2024 20:21:57 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Hi!
Sergey Trofimov <sarg@sarg.org.ru> writes:
> Hi Maxim,
>
> may I ask your review here, as you've authored qmk firmware
> package. I'm adding `keyboard-source-directory` to the
> `make-qmk-firmware` procedure, so that a custom firmware could be
> built without upstreaming a keyboard definition to the main QMK
> repo. Here is how I use it:
> https://github.com/sarg/keyboard/blob/91b87a830ef6029c1023c0d8fc877c067b12ab1e/guix.scm
Makes sense. I'll push shortly.
--
Thanks,
Maxim
--- End Message ---