diff options
| author | Hilton Chain <hako@ultrarare.space> | 2025-05-05 18:30:59 +0800 |
|---|---|---|
| committer | Hilton Chain <hako@ultrarare.space> | 2025-05-14 16:03:28 +0800 |
| commit | 5f3ad33833a04e4e5d27405c20f2a85f241a59ba (patch) | |
| tree | 702ab660dc86f4ca7ce4e6eb86def4686c43e435 | |
| parent | d49157010b581c1d79d9326cd1649f9e0022f66f (diff) | |
utils: with-transformation: Handle more cases.
* nonguix/utils.scm (with-transformation): Skip parameters.
Avoid duplicating file system packages.
| -rw-r--r-- | nonguix/utils.scm | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/nonguix/utils.scm b/nonguix/utils.scm index 961d8bd..4680557 100644 --- a/nonguix/utils.scm +++ b/nonguix/utils.scm | |||
| @@ -64,6 +64,9 @@ matches PRED." | |||
| 64 | (match obj | 64 | (match obj |
| 65 | ((? pred) | 65 | ((? pred) |
| 66 | (proc obj)) | 66 | (proc obj)) |
| 67 | ;; TODO: Check if this can be handled as well. | ||
| 68 | ((? parameter?) | ||
| 69 | obj) | ||
| 67 | ((? procedure?) | 70 | ((? procedure?) |
| 68 | (lambda args | 71 | (lambda args |
| 69 | (apply values | 72 | (apply values |
| @@ -88,14 +91,24 @@ matches PRED." | |||
| 88 | (? origin?)) | 91 | (? origin?)) |
| 89 | obj) | 92 | obj) |
| 90 | ((? record?) | 93 | ((? record?) |
| 91 | (let* ((record-type (record-type-descriptor obj)) | 94 | (cond |
| 92 | (record-fields (record-type-fields record-type))) | 95 | ;; Both ‘file-systems’ and ‘boot-file-system-utilities’ services extends |
| 93 | (apply (record-constructor record-type) | 96 | ;; ‘profile-service-type’ with the same package, however information of |
| 94 | (map (lambda (field) | 97 | ;; the former one is hidden from us, causing conflict in the resulted |
| 95 | (let* ((accessor (record-accessor record-type field)) | 98 | ;; profile. |
| 96 | (obj (accessor obj))) | 99 | ((and (service? obj) |
| 97 | (with-transformation proc obj pred))) | 100 | (eq? 'boot-file-system-utilities |
| 98 | record-fields)))) | 101 | (service-type-name (service-kind obj)))) |
| 102 | obj) | ||
| 103 | (else | ||
| 104 | (let* ((record-type (record-type-descriptor obj)) | ||
| 105 | (record-fields (record-type-fields record-type))) | ||
| 106 | (apply (record-constructor record-type) | ||
| 107 | (map (lambda (field) | ||
| 108 | (let* ((accessor (record-accessor record-type field)) | ||
| 109 | (obj (accessor obj))) | ||
| 110 | (with-transformation proc obj pred))) | ||
| 111 | record-fields)))))) | ||
| 99 | (_ obj))) | 112 | (_ obj))) |
| 100 | 113 | ||
| 101 | (define (package-with-alias alias pkg) | 114 | (define (package-with-alias alias pkg) |
