[PATCH] gnu: Add keyd.

  • Open
  • quality assurance status badge
Details
3 participants
  • Jack Hill
  • Christopher Baines
  • ShinyZero0
Owner
unassigned
Submitted by
ShinyZero0
Severity
normal
S
S
ShinyZero0 wrote on 25 Sep 2023 18:45
(address . guix-patches@gnu.org)
CVS5DY5C7BGC.NFGIXCDSS1WR@fedora
From 01e89ff48c77e12b7a8f206098901e08bc979935 Mon Sep 17 00:00:00 2001
From: "zero@fedora" <shinyzero0@tilde.club>
Date: Mon, 25 Sep 2023 19:39:00 +0300
Subject: [PATCH] gnu: Add keyd

* gnu/packages/keyd.scm: New file.
---
gnu/packages/keyd.scm | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
create mode 100644 gnu/packages/keyd.scm

Toggle diff (51 lines)
diff --git a/gnu/packages/keyd.scm b/gnu/packages/keyd.scm
new file mode 100644
index 0000000000..48afd9f877
--- /dev/null
+++ b/gnu/packages/keyd.scm
@@ -0,0 +1,43 @@
+(define-module (gnu packages keyd))
+(use-modules
+ (guix packages)
+ (gnu packages linux)
+ (guix git-download)
+ ((guix licenses) #:prefix license:)
+ (guix build-system gnu))
+(define-public keyd
+ (package
+ (name "keyd")
+ (version "2.4.3")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/rvaiya/keyd")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32
+ "1awdp863amq95y990fi4wj389ssv3ip2daqz2ph23lsahwa6f5in"))))
+ (arguments
+ (list #:tests? ; no tests
+ #f
+ #:make-flags
+ '(list "CC=gcc"
+ "PREFIX="
+ (string-append
+ "DESTDIR="
+ (assoc-ref %outputs "out")))
+ #:phases
+ '(modify-phases
+ %standard-phases
+ (delete 'configure)))) ; no autoconf
+ (build-system gnu-build-system)
+ (inputs (list linux-libre-headers))
+ (synopsis "A key remapping daemon for linux.")
+ (description
+ "Keyd is a keyboard remapping utility with intuitive ini
+ config file format. Keyd has several unique features, many of
+ which are traditionally only found in custom keyboard firmware
+ like QMK")
+ (home-page "https://github.com/rvaiya/keyd")
+ (license license:expat)))
--
2.41.0
J
J
Jack Hill wrote on 25 Sep 2023 20:59
(name . ShinyZero0)(address . shinyzero0@tilde.club)(address . 66193@debbugs.gnu.org)
alpine.DEB.2.21.2309251433170.16303@marsh.hcoop.net
On Mon, 25 Sep 2023, ShinyZero0 wrote:

Toggle quote (7 lines)
> From 01e89ff48c77e12b7a8f206098901e08bc979935 Mon Sep 17 00:00:00 2001
> From: "zero@fedora" <shinyzero0@tilde.club>
> Date: Mon, 25 Sep 2023 19:39:00 +0300
> Subject: [PATCH] gnu: Add keyd
>
> * gnu/packages/keyd.scm: New file.

Thanks for your submission. keyd looks like a neat package that I did not
know about before!

I'll leave some comments below about some things that I think can be
improved. Can you look into them and send a second version?

Toggle quote (5 lines)
> ---
> gnu/packages/keyd.scm | 43 +++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 43 insertions(+)
> create mode 100644 gnu/packages/keyd.scm

When adding a new file, it should also be added to the list of files in
gnu/local.mk. Also, the "This file is party of GNU Guix" header should be
added to the beginning of this file (it can be copied from another one).
You can also add a copyright line for yourself!

Alternatively, you could put keyd in an existing file. linux.scm might be
a good one. This is a little bit of a judgment call, and I'm not
experienced enough to know what's best. Maybe someone else will chime in
here, or you could ask for advice on IRC.

Toggle quote (30 lines)
> diff --git a/gnu/packages/keyd.scm b/gnu/packages/keyd.scm
> new file mode 100644
> index 0000000000..48afd9f877
> --- /dev/null
> +++ b/gnu/packages/keyd.scm
> @@ -0,0 +1,43 @@
> +(define-module (gnu packages keyd))
> +(use-modules
> + (guix packages)
> + (gnu packages linux)
> + (guix git-download)
> + ((guix licenses) #:prefix license:)
> + (guix build-system gnu))
> +(define-public keyd
> + (package
> + (name "keyd")
> + (version "2.4.3")
> + (source
> + (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/rvaiya/keyd")
> + (commit (string-append "v" version))))
> + (sha256
> + (base32
> + "1awdp863amq95y990fi4wj389ssv3ip2daqz2ph23lsahwa6f5in"))))
> + (arguments
> + (list #:tests? ; no tests
> + #f

I looks to me like there are tests in the t directory. Can they be
enabled?


Also, a little bit of a nitpick, but I think it would be easier to read if
#tests? and #f were on the same line.

Toggle quote (3 lines)
> + #:make-flags
> + '(list "CC=gcc"

Unfortunately, there's a subtle bug here. Most of the time this will work,
but when cross compiling, it will pick the wrong GCC (oops!). Fortunately
we have a cc-for-target procedure that will pick the right one. Here's an
example of it in use:


Toggle quote (5 lines)
> + "PREFIX="
> + (string-append
> + "DESTDIR="
> + (assoc-ref %outputs "out")))

This can probably be upgraded to the new style of using gexps to find the
output. The above example package does that. See also this blog post for
the long explanation:


Toggle quote (13 lines)
> + #:phases
> + '(modify-phases
> + %standard-phases
> + (delete 'configure)))) ; no autoconf
> + (build-system gnu-build-system)
> + (inputs (list linux-libre-headers))
> + (synopsis "A key remapping daemon for linux.")
> + (description
> + "Keyd is a keyboard remapping utility with intuitive ini
> + config file format. Keyd has several unique features, many of
> + which are traditionally only found in custom keyboard firmware
> + like QMK")

Another nitpick: intuitive and unique sound like marketing words to me and
can probably be left out. However that's just my taste.

Toggle quote (3 lines)
> + (license license:expat)))

That's all I have for know. Thanks again for your contribution, and
hopefully you found this review helpful.

All the best,
Jack
S
S
ShinyZero0 wrote on 26 Sep 2023 16:21
[PATCH] gnu: Add keyd
(address . 66193@debbugs.gnu.org)
CVSWXT9ZHO24.3LDYDRIMBKSS7@fedora
From 4926a18454135e97832e2d183893f01a2f42a06c Mon Sep 17 00:00:00 2001
From: "zero@fedora" <shinyzero0@tilde.club>
Date: Mon, 25 Sep 2023 19:39:00 +0300
Subject: [PATCH] gnu: Add keyd

* gnu/packages/keyd.scm: New file.
* gnu/local.mk: Add it.
---
gnu/local.mk | 1 +
gnu/packages/keyd.scm | 60 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 61 insertions(+)
create mode 100644 gnu/packages/keyd.scm

Toggle diff (80 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index bfa816d717..f0745fed65 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -690,6 +690,7 @@ GNU_SYSTEM_MODULES = \
%D%/services/guix.scm \
%D%/services/hurd.scm \
%D%/services/kerberos.scm \
+ %D%/services/keyd.scm \
%D%/services/ldap.scm \
%D%/services/lightdm.scm \
%D%/services/linux.scm \
diff --git a/gnu/packages/keyd.scm b/gnu/packages/keyd.scm
new file mode 100644
index 0000000000..666b931650
--- /dev/null
+++ b/gnu/packages/keyd.scm
@@ -0,0 +1,60 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Paul <shinyzero0@tilde.club>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages keyd)
+ #:use-module (gnu packages linux)
+ #:use-module (guix packages)
+ #:use-module (guix gexp)
+ #:use-module (guix utils)
+ #:use-module (guix git-download)
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix build-system gnu))
+
+(define-public keyd
+ (package
+ (name "keyd")
+ (version "2.4.3")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/rvaiya/keyd")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32
+ "1awdp863amq95y990fi4wj389ssv3ip2daqz2ph23lsahwa6f5in"))))
+ (arguments
+ (list #:tests? #f ; tests require root
+ #:make-flags
+ #~(list (string-append "CC=" #$(cc-for-target))
+ "PREFIX="
+ (string-append "DESTDIR=" #$output))
+ #:phases
+ '(modify-phases
+ %standard-phases
+ (delete 'configure)))) ; no autoconf
+ (build-system gnu-build-system)
+ (inputs (list linux-libre-headers))
+ (synopsis "A key remapping daemon for linux.")
+ (description
+ "Keyd is a keyboard remapping utility with intuitive ini
+ config file format. Keyd has several features, many of
+ which are traditionally only found in custom keyboard firmware
+ like QMK")
+ (home-page "https://github.com/rvaiya/keyd")
+ (license license:expat)))
--
2.41.0
S
S
ShinyZero0 wrote on 26 Sep 2023 16:24
Re: [bug#66193] [PATCH] gnu: Add keyd.
(name . Jack Hill)(address . jackhill@jackhill.us)(address . 66193@debbugs.gnu.org)
CVSX1NHJR90G.2WWSC8W6GMH9Z@fedora
Thanks for your review!
I don't know how should i handle the tests requiring user to be root.
I tried simply removing `sudo` calls but that didn't work, so tests are
still disabled for now.
C
C
Christopher Baines wrote on 4 Oct 2023 13:13
tag 66193 moreinfo
(address . control@debbugs.gnu.org)
87jzs27i8z.fsf@cbaines.net
tags 66193 + moreinfo
quit
?