diff options
| author | coopi <coopi@noreply.codeberg.org> | 2026-06-05 17:02:49 +0400 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2026-07-02 19:17:19 +0200 |
| commit | 980d0d6f76ce6c62ce127245e5396044672cf172 (patch) | |
| tree | 0448f0b8e3bc71b5cdc25e19cb148f7ab49a112d /gnu/services | |
| parent | e7be2ffdd8c5c60670aefb51dc5e10ce601dd3d9 (diff) | |
services: Add kanata-service-type.
* gnu/services/desktop.scm: Import (gnu packages rust-apps).
(kanata-configuration): New record type.
(kanata-shepherd-services): New procedure.
(%kanata-group, %kanata-user, %kanata-accounts, %kanata-udev-rule)
(kanata-service-type): New variables.
* doc/guix.texi (Desktop Services): Document `kanata-service-type'.
Change-Id: I5e8041c6dba17ae0fad33b8ca74099c053c4a3ea
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Merges: #9093
Diffstat (limited to 'gnu/services')
| -rw-r--r-- | gnu/services/desktop.scm | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm index d4a8878bfd3..d0f56cc434c 100644 --- a/gnu/services/desktop.scm +++ b/gnu/services/desktop.scm | |||
| @@ -81,6 +81,7 @@ | |||
| 81 | #:use-module (gnu packages nfs) | 81 | #:use-module (gnu packages nfs) |
| 82 | #:use-module (gnu packages enlightenment) | 82 | #:use-module (gnu packages enlightenment) |
| 83 | #:use-module (gnu packages haskell-apps) | 83 | #:use-module (gnu packages haskell-apps) |
| 84 | #:use-module (gnu packages rust-apps) | ||
| 84 | #:use-module (guix deprecation) | 85 | #:use-module (guix deprecation) |
| 85 | #:use-module (guix i18n) | 86 | #:use-module (guix i18n) |
| 86 | #:use-module (guix records) | 87 | #:use-module (guix records) |
| @@ -130,6 +131,12 @@ | |||
| 130 | kmonad-configuration? | 131 | kmonad-configuration? |
| 131 | kmonad-service-type | 132 | kmonad-service-type |
| 132 | 133 | ||
| 134 | kanata-service-type | ||
| 135 | kanata-configuration | ||
| 136 | kanata-configuration? | ||
| 137 | kanata-configuration-kanata | ||
| 138 | kanata-configuration-keymaps | ||
| 139 | |||
| 133 | geoclue-application | 140 | geoclue-application |
| 134 | geoclue-configuration | 141 | geoclue-configuration |
| 135 | geoclue-configuration? | 142 | geoclue-configuration? |
| @@ -1110,6 +1117,85 @@ and extending the functionalities of different keyboards."))) | |||
| 1110 | 1117 | ||
| 1111 | 1118 | ||
| 1112 | ;;; | 1119 | ;;; |
| 1120 | ;;; Kanata. | ||
| 1121 | ;;; | ||
| 1122 | |||
| 1123 | (define-configuration/no-serialization kanata-configuration | ||
| 1124 | (kanata | ||
| 1125 | (package kanata) | ||
| 1126 | "The @code{kanata} package to use.") | ||
| 1127 | (keymaps | ||
| 1128 | (list-of-file-likes '()) | ||
| 1129 | "List of @command{kanata} configuration files (file-like objects). See | ||
| 1130 | @uref{https://jtroo.github.io/config.html#linux-only-linux-dev, Kanata's | ||
| 1131 | device specification documentation}.")) | ||
| 1132 | |||
| 1133 | (define %kanata-group | ||
| 1134 | (user-group | ||
| 1135 | (name "kanata") | ||
| 1136 | (system? #t))) | ||
| 1137 | |||
| 1138 | (define %kanata-user | ||
| 1139 | (user-account | ||
| 1140 | (name "kanata") | ||
| 1141 | (group "kanata") | ||
| 1142 | (supplementary-groups '("input" "uinput")) | ||
| 1143 | (system? #t) | ||
| 1144 | (comment "Kanata daemon user") | ||
| 1145 | (home-directory "/var/empty") | ||
| 1146 | (create-home-directory? #f) | ||
| 1147 | (shell (file-append shadow "/sbin/nologin")))) | ||
| 1148 | |||
| 1149 | (define %kanata-accounts | ||
| 1150 | (list %uinput-group %kanata-group %kanata-user)) | ||
| 1151 | |||
| 1152 | ;; OPTIONS+="static_node=uinput" triggers kmod to load the uinput module on | ||
| 1153 | ;; boot. | ||
| 1154 | (define %kanata-udev-rule | ||
| 1155 | (udev-rule | ||
| 1156 | "99-kanata.rules" | ||
| 1157 | "KERNEL==\"uinput\", MODE=\"0660\", GROUP=\"uinput\", OPTIONS+=\"static_node=uinput\"\n")) | ||
| 1158 | |||
| 1159 | (define (kanata-shepherd-services config) | ||
| 1160 | "Return a shepherd service for each @command{kanata} configuration." | ||
| 1161 | (let* ((kanata (file-append (kanata-configuration-kanata config) | ||
| 1162 | "/bin/kanata")) | ||
| 1163 | (keymaps (kanata-configuration-keymaps config))) | ||
| 1164 | (map (lambda (index keymap) | ||
| 1165 | (let ((name (string-append "kanata-" (number->string index)))) | ||
| 1166 | (shepherd-service | ||
| 1167 | (provision (list (string->symbol name))) | ||
| 1168 | (requirement '(user-processes udev)) | ||
| 1169 | (documentation (string-append "Run kanata process " | ||
| 1170 | (number->string index) ".")) | ||
| 1171 | (start #~(make-forkexec-constructor | ||
| 1172 | ;; '--no-wait' prevents pausing on exit so | ||
| 1173 | ;; Shepherd can reliably restart the daemon. | ||
| 1174 | (list #$kanata "-c" #$keymap "--no-wait") | ||
| 1175 | #:user "kanata" | ||
| 1176 | #:group "kanata" | ||
| 1177 | #:supplementary-groups '("input" "uinput") | ||
| 1178 | #:log-file #$(string-append "/var/log/" name ".log"))) | ||
| 1179 | (stop #~(make-kill-destructor))))) | ||
| 1180 | (iota (length keymaps)) | ||
| 1181 | keymaps))) | ||
| 1182 | |||
| 1183 | (define kanata-service-type | ||
| 1184 | (service-type | ||
| 1185 | (name 'kanata) | ||
| 1186 | (extensions | ||
| 1187 | (list (service-extension account-service-type | ||
| 1188 | (const %kanata-accounts)) | ||
| 1189 | (service-extension shepherd-root-service-type | ||
| 1190 | kanata-shepherd-services) | ||
| 1191 | (service-extension udev-service-type | ||
| 1192 | (const (list %kanata-udev-rule))))) | ||
| 1193 | (description | ||
| 1194 | "Run the @command{kanata} daemon, which allows customizing and extending | ||
| 1195 | the functionalities of different keyboards."))) | ||
| 1196 | |||
| 1197 | |||
| 1198 | ;;; | ||
| 1113 | ;;; UDisks. | 1199 | ;;; UDisks. |
| 1114 | ;;; | 1200 | ;;; |
| 1115 | 1201 | ||
