[bug#75283,rust-team] gnu: rust-xremap: Use output for each feature.
Commit Message
* gnu/packages/rust-apps.scm (output-features): Add procedure.
(rust-xremap)[outputs]: Add.
[arguments]: Remove features, add modules and output-features phases.
(xremap-gnome, xremap-kde, xremap-wlroots, xremap-hyprland, xremap-sway,
xremap-x11): Deprecate.
Change-Id: I9cf6a27f908a0fa42e89daba12fba3615d05ad4e
---
gnu/packages/rust-apps.scm | 79 +++++++++++++++++++++-----------------
1 file changed, 44 insertions(+), 35 deletions(-)
base-commit: 5f92f009a19c1a5a8b7df5a7bcb1e1f283a953f8
@@ -28,7 +28,7 @@
;;; Copyright © 2023, 2024 Jaeme Sifat <jaeme@runbox.com>
;;; Copyright © 2023 Steve George <steve@futurile.net>
;;; Copyright © 2024 Troy Figiel <troy@troyfigiel.com>
-;;; Copyright © 2024 Herman Rimm <herman@rimm.ee>
+;;; Copyright © 2024-2025 Herman Rimm <herman@rimm.ee>
;;; Copyright © 2024 Tomas Volf <~@wolfsden.cz>
;;; Copyright © 2024 Suhail Singh <suhail@bayesians.ca>
;;; Copyright © 2024 Jordan Moore <lockbox@struct.foo>
@@ -113,7 +113,8 @@ (define-module (gnu packages rust-apps)
#:use-module (gnu packages tls)
#:use-module (gnu packages version-control)
#:use-module (gnu packages webkit)
- #:use-module (gnu packages xorg))
+ #:use-module (gnu packages xorg)
+ #:use-module (srfi srfi-1))
(define-public aardvark-dns
(package
@@ -4244,6 +4245,34 @@ (define-public git-delta
@command{grep} and a stylized box presentation.")
(license license:expat)))
+(define* (output-features output #:optional (features (list output)))
+ (define (phase-name prefix)
+ (string->symbol (string-append prefix "-" output)))
+
+ (define set-args
+ `(let loop ((lst args)
+ (result '()))
+ (match lst
+ (() (reverse result))
+ ((#:outputs outputs rest ...)
+ ;; XXX: Make give output the default.
+ (loop rest (cons* `(("out" . ,(assoc-ref outputs ,output)))
+ #:outputs result)))
+ ((#:features _ rest ...)
+ (loop rest (cons* ',features #:features result)))
+ ((kw value rest ...)
+ (loop rest (cons* value kw result))))))
+ ;; XXX: Run after previous install-output phase.
+ `((add-after 'install ',(phase-name "build")
+ (lambda args
+ (apply (assoc-ref %standard-phases 'build) ,set-args)))
+ (add-after ',(phase-name "build") ',(phase-name "check")
+ (lambda args
+ (apply (assoc-ref %standard-phases 'check) ,set-args)))
+ (add-after ',(phase-name "check") ',(phase-name "install")
+ (lambda args
+ (apply (assoc-ref %standard-phases 'install) ,set-args)))))
+
(define-public rust-xremap
(package
(name "rust-xremap")
@@ -4257,9 +4286,9 @@ (define-public rust-xremap
(base32
"0whvw9bbgjf5znb3025iqkj2aijasg6fcx9q1jy97kb0s4m996q2"))))
(build-system cargo-build-system)
+ (outputs '("out" "hyprland" "gnome" "kde" "wlroots" "x11"))
(arguments
- `(#:features '()
- #:install-source? #f
+ `(#:install-source? #f
#:cargo-inputs
(("rust-anyhow" ,rust-anyhow-1)
("rust-clap" ,rust-clap-4)
@@ -4283,8 +4312,13 @@ (define-public rust-xremap
("rust-wayland-protocols-wlr" ,rust-wayland-protocols-wlr-0.1)
("rust-x11rb" ,rust-x11rb-0.13)
("rust-zbus" ,rust-zbus-1))
+ #:modules ((guix build cargo-build-system)
+ (guix build utils)
+ (ice-9 match))
#:phases
(modify-phases %standard-phases
+ ,@(concatenate (map output-features (drop outputs 1)))
+ ;; XXX: Separately output default xremap and completions?
(add-after 'install 'install-completions
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
@@ -4312,47 +4346,22 @@ (define-public rust-xremap
(license license:expat)))
(define-public xremap-gnome
- (package
- (inherit rust-xremap)
- (name "xremap-gnome")
- (arguments
- (substitute-keyword-arguments (package-arguments rust-xremap)
- ((#:features _) '(list "gnome"))))))
+ (deprecated-package "xremap-gnome" rust-xremap))
(define-public xremap-kde
- (package
- (inherit rust-xremap)
- (name "xremap-kde")
- (arguments
- (substitute-keyword-arguments (package-arguments rust-xremap)
- ((#:features _) '(list "kde"))))))
+ (deprecated-package "xremap-kde" rust-xremap))
(define-public xremap-wlroots
- (package
- (inherit rust-xremap)
- (name "xremap-wlroots")
- (arguments
- (substitute-keyword-arguments (package-arguments rust-xremap)
- ((#:features _) '(list "wlroots"))))))
+ (deprecated-package "xremap-wlroots" rust-xremap))
(define-public xremap-hyprland
- (package
- (inherit rust-xremap)
- (name "xremap-hyprland")
- (arguments
- (substitute-keyword-arguments (package-arguments rust-xremap)
- ((#:features _) '(list "hyprland"))))))
+ (deprecated-package "xremap-hyprland" rust-xremap))
(define-public xremap-sway
- (deprecated-package "xremap-sway" xremap-wlroots))
+ (deprecated-package "xremap-sway" rust-xremap))
(define-public xremap-x11
- (package
- (inherit rust-xremap)
- (name "xremap-x11")
- (arguments
- (substitute-keyword-arguments (package-arguments rust-xremap)
- ((#:features _) '(list "x11"))))))
+ (deprecated-package "xremap-x11" rust-xremap))
(define-public xsv
(package