diff options
author | Hilton Chain <hako@ultrarare.space> | 2025-01-20 14:20:50 +0800 |
---|---|---|
committer | Hilton Chain <hako@ultrarare.space> | 2025-04-04 12:22:03 +0800 |
commit | ca1de9c7124acff1d6e8196cd704d86ac244c318 (patch) | |
tree | 48b5f9adf187cfaa3e94c56cc6dbd550280baf8a | |
parent | d8aa9af09f901d1745470caa45ffe2178a9afce1 (diff) |
nonguix: Add package-input-grafting.
* nonguix/utils.scm (package-input-grafting): New procedure.
-rw-r--r-- | nonguix/utils.scm | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/nonguix/utils.scm b/nonguix/utils.scm index 4deb597..9dc5b21 100644 --- a/nonguix/utils.scm +++ b/nonguix/utils.scm @@ -11,7 +11,8 @@ #:use-module (guix utils) #:use-module (guix packages) #:use-module (gnu services) - #:export (with-transformation)) + #:export (package-input-grafting + with-transformation)) (define-public (to32 package64) "Build package for i686-linux. @@ -26,6 +27,34 @@ Only x86_64-linux and i686-linux are supported. ,@(package-arguments package64))))) (_ package64))) +(define (package-input-grafting replacements) + "Return a procedure that, when passed a package, grafts its direct and +indirect dependencies, including implicit inputs, according to REPLACEMENTS. +REPLACEMENTS is a list of package pairs; the first element of each pair is the +package to replace, and the second one is the replacement. + +Name and version of replacement packages will be padded to meet graft +requirement." + (package-input-rewriting + (map (match-lambda + ((old . new) + `(,old . ,(package + (inherit old) + (replacement + (package + (inherit new) + (name + (string-pad-right + (package-name new) + (string-length (package-name old)) + #\0)) + (version + (string-pad-right + (package-version new) + (string-length (package-version old)) + #\0)))))))) + replacements))) + ;; For concerns and direction of improvement, see this thread: ;; https://lists.gnu.org/archive/html/guix-devel/2024-06/msg00275.html (define* (with-transformation proc obj #:optional (pred package?)) |