Compare commits

..

7 Commits

Author SHA1 Message Date
Hilton Chain
9386fb64b7
rosenthal: Add emacs-kdl-mode.
* modules/rosenthal/packages/emacs-xyz.scm (emacs-kdl-mode): New variable.
2026-02-14 00:37:22 +08:00
Hilton Chain
7c6e2c6c98
rosenthal: alloy-bin: Use ‘mapping-for-system’. 2026-02-14 00:37:22 +08:00
Hilton Chain
a42b6b4d24
rosenthal: alloy-bin: Switch to gnu-build-system for proper cross build support. 2026-02-14 00:37:21 +08:00
Hilton Chain
9f069f714d
rosenthal: alloy-bin: Use ‘binary-package’. 2026-02-14 00:37:21 +08:00
Hilton Chain
2db419232a
utils: Add ‘mapping-for-system’ and ‘binary-package’.
* modules/rosenthal/utils/packages.scm (system-mapping, binary-package): New
procedures.
2026-02-14 00:37:21 +08:00
Hilton Chain
9c244cfe3b
utils: %binary-source: Adjust package.
* modules/rosenthal/utils/packages.scm (%binary-source): Override home-page,
synopsis, description and license.
2026-02-14 00:37:16 +08:00
Hilton Chain
2fa2efe8ae
rosenthal: Remove %rosenthal-set-keymap.
It'll be moved to the testament repository.

* modules/rosenthal/services/desktop.scm (%rosenthal-set-keymap-script)
(%rosenthal-set-keymap): Delete variables.
2026-02-13 14:47:16 +08:00
4 changed files with 124 additions and 181 deletions

View File

@ -11,11 +11,13 @@
#:use-module (guix gexp) #:use-module (guix gexp)
#:use-module ((guix licenses) #:prefix license:) #:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix platform)
#:use-module (guix utils) #:use-module (guix utils)
#:use-module (rosenthal utils packages) #:use-module (rosenthal utils packages)
;; Guix origin methods ;; Guix origin methods
#:use-module (guix download) #:use-module (guix download)
;; Guix build systems ;; Guix build systems
#:use-module (guix build-system gnu)
#:use-module (guix build-system copy) #:use-module (guix build-system copy)
;; Guix packages ;; Guix packages
#:use-module (gnu packages base) #:use-module (gnu packages base)
@ -483,76 +485,72 @@ rather a set of labels for each log stream.")
"1pxnjzygm2mylipf6cjkqxm4k3i9vnm7v80avxbhv8400p3aszqk")))))) "1pxnjzygm2mylipf6cjkqxm4k3i9vnm7v80avxbhv8400p3aszqk"))))))
(define-public alloy-bin (define-public alloy-bin
(package (binary-package
(name "alloy-bin") `(("x86_64-linux" . ,%alloy-source-x86_64-linux)
(version (package-version %alloy-source-x86_64-linux)) ("aarch64-linux" . ,%alloy-source-aarch64-linux))
(source #f) (package
(build-system copy-build-system) (name "alloy-bin")
(arguments (version "")
(let ((binary-source (source #f)
(match (or (%current-target-system) (build-system gnu-build-system)
(%current-system)) (arguments
((? target-aarch64?) (list
(package-source %alloy-source-aarch64-linux)) #:modules
(_ `((ice-9 match)
(package-source %alloy-source-x86_64-linux))))) ,@%default-gnu-modules)
(list #:phases
#:install-plan #~(modify-phases %standard-phases
(match (or (%current-target-system) (delete 'bootstrap)
(%current-system)) (delete 'configure)
((? target-aarch64?) (delete 'build)
#~'(("alloy-linux-arm64" "bin/alloy"))) (delete 'check)
(_ (replace 'install
#~'(("alloy-linux-amd64" "bin/alloy")))) (lambda _
#:modules (let ((src #$(mapping-for-system
'((ice-9 match) '(("x86_64-linux" . "alloy-linux-amd64")
(guix build copy-build-system) ("aarch64-linux" . "alloy-linux-arm64"))))
(guix build utils)) (dst (in-vicinity #$output "bin/alloy")))
#:phases (mkdir-p (dirname dst))
#~(modify-phases %standard-phases (copy-file src dst))))
(replace 'unpack (add-after 'install 'patch-elf
(lambda _ (lambda* (#:key inputs #:allow-other-keys)
((assoc-ref %standard-phases 'unpack) (let ((ld.so (search-input-file inputs #$(glibc-dynamic-linker)))
#:source #+binary-source))) (dest (in-vicinity #$output "bin"))
(add-after 'install 'patch-elf (name "alloy"))
(lambda _ (with-directory-excursion dest
(let ((name "alloy") (invoke "patchelf" "--set-interpreter" ld.so name)
(dest (in-vicinity #$output "bin")) (chmod name #o555)))))
(ld.so #$(file-append glibc (glibc-dynamic-linker)))) (add-after 'patch-elf 'install-extras
(with-directory-excursion dest (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
(invoke "patchelf" "--set-interpreter" ld.so name) (let ((alloy
(chmod name #o555))))) (search-input-file
(add-after 'patch-elf 'install-extras
(lambda* (#:key native-inputs inputs #:allow-other-keys)
(let ((alloy
(if #$(%current-target-system) (if #$(%current-target-system)
(search-input-file (or native-inputs inputs) native-inputs
"bin/alloy") outputs)
(in-vicinity #$output "bin/alloy")))) "bin/alloy")))
(for-each (for-each
(match-lambda (match-lambda
((shell . file) ((shell . file)
(mkdir-p (in-vicinity #$output (dirname file))) (mkdir-p (in-vicinity #$output (dirname file)))
(with-output-to-file (in-vicinity #$output file) (with-output-to-file (in-vicinity #$output file)
(lambda () (lambda ()
(invoke alloy "completion" shell))))) (invoke alloy "completion" shell)))))
'(("bash" . "share/bash-completion/completions/alloy") '(("bash" . "share/bash-completion/completions/alloy")
("fish" . "share/fish/vendor_completions.d/alloy.fish") ("fish" . "share/fish/vendor_completions.d/alloy.fish")
("zsh" . "share/zsh/site-functions/_alloy")))))))))) ("zsh" . "share/zsh/site-functions/_alloy")))))))))
(native-inputs (native-inputs
(append (if (%current-target-system) (append (if (%current-target-system)
(list this-package) (list this-package)
'()) '())
(list patchelf unzip))) (list patchelf unzip)))
(supported-systems '("x86_64-linux" "aarch64-linux")) (supported-systems '("x86_64-linux" "aarch64-linux"))
(home-page "https://grafana.com/oss/alloy-opentelemetry-collector/") (home-page "https://grafana.com/oss/alloy-opentelemetry-collector/")
(synopsis (synopsis
"OpenTelemetry Collector distribution with programmable pipelines") "OpenTelemetry Collector distribution with programmable pipelines")
(description (description
"Grafana Alloy is an open source OpenTelemetry Collector distribution with "Grafana Alloy is an open source OpenTelemetry Collector distribution with
built-in Prometheus pipelines and support for metrics, logs, traces, and built-in Prometheus pipelines and support for metrics, logs, traces, and
profiles.") profiles.")
(license license:agpl3) (license license:agpl3))))
(properties '((disable-updater? . #t)))))
(define-deprecated-package alloy-bin-aarch64-linux alloy-bin) (define-deprecated-package alloy-bin-aarch64-linux alloy-bin)

View File

@ -82,6 +82,28 @@ end the search. Moreover, the search status information in the echo area and
some keybindings are slightly simplified.") some keybindings are slightly simplified.")
(license license:gpl3+))) (license license:gpl3+)))
(define-public emacs-kdl-mode
(let ((commit "2d849e298199f490e4894c01764a8a83decd704a")
(revision "0"))
(package
(name "emacs-kdl-mode")
(version (git-version "0.0.1" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/taquangtrung/emacs-kdl-mode")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"18va5ipay9grbv84kwq9ji4dn1sabnzydj4hb1mjd9mbbibw1wg4"))))
(build-system emacs-build-system)
(arguments (list #:tests? #f)) ;No tests.
(home-page "https://github.com/taquangtrung/emacs-kdl-mode")
(synopsis "Emacs major mode for editing files in the KDL document language")
(description "")
(license license:gpl3+))))
(define-public emacs-pcmpl-tailscale (define-public emacs-pcmpl-tailscale
(let ((commit "acd6bce54af506b0450cf6aa1068f63d4e25c8ce") (let ((commit "acd6bce54af506b0450cf6aa1068f63d4e25c8ce")
(revision "0")) (revision "0"))

View File

@ -74,7 +74,6 @@
home-waybar-configuration home-waybar-configuration
home-waybar-service-type home-waybar-service-type
%rosenthal-set-keymap
%rosenthal-skeletons %rosenthal-skeletons
%rosenthal-desktop-services/gdm %rosenthal-desktop-services/gdm
%rosenthal-desktop-services/tuigreet %rosenthal-desktop-services/tuigreet
@ -551,116 +550,6 @@ gtk-key-theme-name = ~a~%"
;;; Configuration file presets. ;;; Configuration file presets.
;;; ;;;
(define %rosenthal-set-keymap-script
(program-file "set-keymap"
(with-imported-modules (source-module-closure '((guix build utils)))
#~(begin
(use-modules (srfi srfi-1)
(srfi srfi-26)
(srfi srfi-37)
(ice-9 match)
(ice-9 popen)
(guix build utils))
(define* (build-keyboard-layout file layout #:optional variant #:key model options)
(define pipe
(apply open-pipe* OPEN_READ
#$(file-append console-setup "/bin/ckbcomp")
(string-append "-I" #$xkeyboard-config "/share/X11/xkb")
"-rules" "base"
`(,@(if model
'("-model" ,model)
'())
,layout
,(or variant "")
,(string-join options ","))))
(mkdir-p (dirname file))
(call-with-output-file file
(lambda (output)
(dump-port pipe output))))
(define* (set-keyboard-layout layout #:optional variant #:key model options)
(define file-name
(port-filename
(mkstemp "/tmp/console-keymap.XXXXXX")))
(build-keyboard-layout file-name layout variant #:model model #:options options)
(invoke "sudo" #$(file-append kbd "/bin/loadkeys") file-name)
(false-if-exception
(substitute*
(in-vicinity
(if (zero? (getuid))
"/home/live/.config"
(getenv "XDG_CONFIG_HOME"))
"niri/config.kdl")
(("^ (layout|variant|model|options) .*") "")
(("^ xkb \\{.*" line)
(string-append
line
(format #f " layout ~s~%" layout)
(if variant (format #f " variant ~s~%" variant) "")
(if model (format #f " model ~s~%" model) "")
(format #f " options ~s~%" (string-join options ",")))))))
(define (show-help-and-exit)
(display "\
Usage: set-keymap LAYOUT [VARIANT] [-m MODEL] [-o OPTIONS]
OPTIONS are comma-separated e.g. \"ctrl:nocaps,grp:alt_shift_toggle\"
Examples:
set-keymap us
set-keymap us dvorak
set-keymap us dvorak -o ctrl:nocaps\n")
(quit))
(define (parse-options)
(args-fold (cdr (program-arguments))
(list (option '(#\m "model") #t #f
(lambda (opt name arg result)
(alist-cons 'model arg result)))
(option '(#\o "options") #t #f
(lambda (opt name arg result)
(alist-cons 'options (string-split arg #\,)
result)))
(option '("help") #f #f
(lambda _
(show-help-and-exit))))
(lambda (opt name arg loads)
(error "Unrecognized option `~A'" name))
(lambda (opt loads) (cons opt loads))
'()))
(let* ((opts (parse-options))
(model (assoc-ref opts 'model))
(options (or (assoc-ref opts 'options) '()))
(args (remove pair? (reverse opts))))
(match args
((layout)
(set-keyboard-layout layout #:model model #:options options))
((layout variant)
(set-keyboard-layout layout variant #:model model #:options options))
(_
(show-help-and-exit))))))))
(define %rosenthal-set-keymap
(hidden-package
(package
(name "rosenthal-set-keymap")
(version "0.0.0")
(source %rosenthal-set-keymap-script)
(build-system copy-build-system)
(arguments
(list
#:phases
#~(modify-phases %standard-phases
(replace 'install
(lambda _
(install-file "set-keymap" (in-vicinity #$output "bin")))))))
(home-page "")
(synopsis "")
(description "")
(license #f))))
(define %rosenthal-skeletons (define %rosenthal-skeletons
`((".config/emacs/init.el" `((".config/emacs/init.el"
,(local-file "../examples/emacs/init.el")) ,(local-file "../examples/emacs/init.el"))

View File

@ -11,10 +11,13 @@
#:use-module (guix deprecation) #:use-module (guix deprecation)
#:use-module (guix diagnostics) #:use-module (guix diagnostics)
#:use-module (guix discovery) #:use-module (guix discovery)
#:use-module (guix gexp)
#:use-module (guix i18n) #:use-module (guix i18n)
#:use-module (guix memoization) #:use-module (guix memoization)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix platform)
#:use-module (guix ui) #:use-module (guix ui)
#:use-module (guix utils)
;; Guix packages ;; Guix packages
#:use-module (gnu packages) #:use-module (gnu packages)
#:use-module (gnu packages base) #:use-module (gnu packages base)
@ -32,7 +35,9 @@
specs->pkgs specs->pkgs
specs->pkgs+out specs->pkgs+out
%binary-source)) %binary-source
binary-package
mapping-for-system))
(define %rosenthal-root-directory (define %rosenthal-root-directory
;; This is like %distro-root-directory from (gnu packages), with adjusted ;; This is like %distro-root-directory from (gnu packages), with adjusted
@ -145,4 +150,33 @@ packages, excluding superseded packages."
(hidden-package (hidden-package
(package (package
(inherit hello) (inherit hello)
(supported-systems '())))) (supported-systems '())
(home-page "")
(synopsis "Binary package source (internal use)")
(description "")
(license #f))))
(define* (mapping-for-system mapping #:optional (default-system "x86_64-linux"))
(let ((system
(or (and=> (%current-target-system) platform-target->system)
(%current-system))))
(or (assoc-ref mapping system)
(assoc-ref mapping default-system))))
(define* (binary-package source-mapping p #:optional (default-system "x86_64-linux"))
(package
(inherit p)
(version (package-version (assoc-ref source-mapping default-system)))
(source #f)
(arguments
(substitute-keyword-arguments (package-arguments p)
((#:phases phases #~%standard-phases)
#~(modify-phases #$phases
(replace 'unpack
(lambda _
((assoc-ref %standard-phases 'unpack)
#:source
#+(package-source (mapping-for-system source-mapping)))))))))
(properties
(cons '(disable-updater? . #t)
(package-properties p)))))