summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHilton Chain <hako@ultrarare.space>2025-05-05 18:30:59 +0800
committerHilton Chain <hako@ultrarare.space>2025-05-14 16:03:28 +0800
commit5f3ad33833a04e4e5d27405c20f2a85f241a59ba (patch)
tree702ab660dc86f4ca7ce4e6eb86def4686c43e435
parentd49157010b581c1d79d9326cd1649f9e0022f66f (diff)
utils: with-transformation: Handle more cases.
* nonguix/utils.scm (with-transformation): Skip parameters. Avoid duplicating file system packages.
-rw-r--r--nonguix/utils.scm29
1 files changed, 21 insertions, 8 deletions
diff --git a/nonguix/utils.scm b/nonguix/utils.scm
index 961d8bde..46805570 100644
--- a/nonguix/utils.scm
+++ b/nonguix/utils.scm
@@ -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,14 +91,24 @@ matches PRED."
(? origin?))
obj)
((? record?)
- (let* ((record-type (record-type-descriptor obj))
- (record-fields (record-type-fields record-type)))
- (apply (record-constructor record-type)
- (map (lambda (field)
- (let* ((accessor (record-accessor record-type field))
- (obj (accessor obj)))
- (with-transformation proc obj pred)))
- record-fields))))
+ (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)
+ (map (lambda (field)
+ (let* ((accessor (record-accessor record-type field))
+ (obj (accessor obj)))
+ (with-transformation proc obj pred)))
+ record-fields))))))
(_ obj)))
(define (package-with-alias alias pkg)