Compare commits

..

3 Commits

Author SHA1 Message Date
Hilton Chain
538eb0c46a
rosenthal: ai-robots-txt: Update to 1.37.
* modules/rosenthal/packages/web.scm (ai-robots-txt): Update to 1.37.
2025-06-15 13:23:41 +08:00
Hilton Chain
a28d0921d9
rosenthal: Add ‘keyboard-layout->console-keymap’.
* modules/rosenthal/system/keyboard.scm: New file.
2025-06-15 13:21:51 +08:00
Hilton Chain
08f3b94e16
services: home-keyboard: Export set-xkb-variables.
* modules/rosenthal/services/keyboard.scm (set-xkb-variables): Export.
2025-06-15 13:21:22 +08:00
3 changed files with 80 additions and 3 deletions

View File

@ -20,7 +20,7 @@
(define-public ai-robots-txt (define-public ai-robots-txt
(package (package
(name "ai-robots-txt") (name "ai-robots-txt")
(version "1.36") (version "1.37")
(source (origin (source (origin
(method git-fetch) (method git-fetch)
(uri (git-reference (uri (git-reference
@ -29,7 +29,7 @@
(file-name (git-file-name name version)) (file-name (git-file-name name version))
(sha256 (sha256
(base32 (base32
"1b3yc4abd6ni43dqp352lf8bmb328y1yhq8din7hscfg694i3i2d")) "13l43bvr80bfy19dijl9x66ldl5zcxadvwcsdaajwnvykj3my5sq"))
(modules '((guix build utils))) (modules '((guix build utils)))
(snippet '(delete-file-recursively "code")))) (snippet '(delete-file-recursively "code"))))
(build-system copy-build-system) (build-system copy-build-system)

View File

@ -5,7 +5,8 @@
(define-module (rosenthal services keyboard) (define-module (rosenthal services keyboard)
#:use-module (gnu system keyboard) #:use-module (gnu system keyboard)
#:use-module (gnu home services) #:use-module (gnu home services)
#:export (home-keyboard-service-type)) #:export (set-xkb-variables
home-keyboard-service-type))
(define (set-xkb-variables layout) (define (set-xkb-variables layout)
(if layout (if layout

View File

@ -0,0 +1,76 @@
;;; Copyright © 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;;
;;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal system keyboard)
#:use-module (srfi srfi-9 gnu)
#:use-module (ice-9 match)
#:use-module (guix gexp)
#:export (keyboard-layout
keyboard-layout->console-keymap))
;; Copied from (gnu system keyboard), with package dependencies removed. To
;; use this module, packages console-setup and xkeyboard-config should be
;; installed into the system profile.
;; Copied from (gnu system keyboard) to avoid package dependencies.
(define-immutable-record-type <keyboard-layout>
(%keyboard-layout name variant model options)
keyboard-layout?
(name keyboard-layout-name) ;string
(variant keyboard-layout-variant) ;#f | string
(model keyboard-layout-model) ;#f | string
(options keyboard-layout-options)) ;list of strings
(define* (keyboard-layout name #:optional variant
#:key model (options '()))
"Return a new keyboard layout with the given NAME and VARIANT.
NAME must be a string such as \"fr\"; VARIANT must be a string such as
\"bepo\" or \"nodeadkeys\". See the 'xkeyboard-config' package for valid
options."
(%keyboard-layout name variant model options))
(define* (keyboard-layout->console-keymap layout)
"Return a Linux console keymap file for LAYOUT, a <keyboard-layout> record.
Layout information is taken from the XKEYBOARD-CONFIG package."
(define %current-system
"/run/current-system/profile")
(define build
(with-imported-modules '((guix build utils))
#~(begin
(use-modules (guix build utils)
(ice-9 popen)
(ice-9 match))
(define pipe
(open-pipe* OPEN_READ
(in-vicinity %current-system "bin/ckbcomp")
(string-append
"-I" (in-vicinity %current-system "share/X11/xkb"))
"-rules" "base"
#$@(match (keyboard-layout-model layout)
(#f '())
(model `("-model" ,model)))
#$(keyboard-layout-name layout)
#$(or (keyboard-layout-variant layout)
"")
#$(string-join (keyboard-layout-options layout) ",")))
(call-with-output-file #$output
(lambda (output)
(dump-port pipe output)))
;; Note: ckbcomp errors out when the layout name is unknown, but
;; merely emits a warning when the variant is unknown.
(unless (zero? (close-pipe pipe))
(error "failed to create console keymap for keyboard layout"
#$(keyboard-layout-name layout))))))
(computed-file (string-append "console-keymap."
(string-map (match-lambda
(#\, #\-)
(chr chr))
(keyboard-layout-name layout)))
build))