utils: with-transformation: Handle more cases.

* nonguix/utils.scm (with-transformation): Skip parameters.
Avoid duplicating file system packages.
This commit is contained in:
Hilton Chain 2025-05-05 18:30:59 +08:00
parent d49157010b
commit 5f3ad33833
No known key found for this signature in database
GPG key ID: ACC66D09CA528292

View file

@ -64,6 +64,9 @@ matches PRED."
(match obj
((? pred)
(proc obj))
;; TODO: Check if this can be handled as well.
((? parameter?)
obj)
((? procedure?)
(lambda args
(apply values
@ -88,6 +91,16 @@ matches PRED."
(? origin?))
obj)
((? record?)
(cond
;; Both file-systems and boot-file-system-utilities services extends
;; profile-service-type with the same package, however information of
;; the former one is hidden from us, causing conflict in the resulted
;; profile.
((and (service? obj)
(eq? 'boot-file-system-utilities
(service-type-name (service-kind obj))))
obj)
(else
(let* ((record-type (record-type-descriptor obj))
(record-fields (record-type-fields record-type)))
(apply (record-constructor record-type)
@ -95,7 +108,7 @@ matches PRED."
(let* ((accessor (record-accessor record-type field))
(obj (accessor obj)))
(with-transformation proc obj pred)))
record-fields))))
record-fields))))))
(_ obj)))
(define (package-with-alias alias pkg)