unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Sergey Trofimov <sarg@sarg.org.ru>
To: 67534@debbugs.gnu.org
Cc: Sergey Trofimov <sarg@sarg.org.ru>,
	Efraim Flashner <efraim@flashner.co.il>,
	Vagrant Cascadian <vagrant@debian.org>
Subject: [bug#67534] [PATCH] gnu: qmk: Support custom keyboards.
Date: Wed, 29 Nov 2023 21:32:12 +0100	[thread overview]
Message-ID: <940c712802a6bb69dde97dca4b6c01524d0a0a1e.1701289507.git.sarg@sarg.org.ru> (raw)

* 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





             reply	other threads:[~2023-11-29 20:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-29 20:32 Sergey Trofimov [this message]
2024-03-21 21:16 ` [bug#67534] Requesting review Sergey Trofimov
2024-04-01  0:21   ` bug#67534: " Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=940c712802a6bb69dde97dca4b6c01524d0a0a1e.1701289507.git.sarg@sarg.org.ru \
    --to=sarg@sarg.org.ru \
    --cc=67534@debbugs.gnu.org \
    --cc=efraim@flashner.co.il \
    --cc=vagrant@debian.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).