aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2024-10-28 22:25:14 +0000
committerArun Isaac2024-11-06 00:37:11 +0000
commit366d5a94b07a879abf4d85dc11ef7bf3b3369aae (patch)
tree3865c8a6949570327a802ad8f0ee69bda818fa6b
parente44044582536f67fe15dfc20a7b8129ebd16424c (diff)
downloadravanan-366d5a94b07a879abf4d85dc11ef7bf3b3369aae.tar.gz
ravanan-366d5a94b07a879abf4d85dc11ef7bf3b3369aae.tar.lz
ravanan-366d5a94b07a879abf4d85dc11ef7bf3b3369aae.zip
command-line-tool: Allow processing manifest objects without a file.
* ravanan/command-line-tool.scm (manifest->environment): New function. (manifest-file->environment)[build-derivation]: Delete function. Call manifest->environment.
-rw-r--r--ravanan/command-line-tool.scm50
1 files changed, 28 insertions, 22 deletions
diff --git a/ravanan/command-line-tool.scm b/ravanan/command-line-tool.scm
index 83dec50..6f95b88 100644
--- a/ravanan/command-line-tool.scm
+++ b/ravanan/command-line-tool.scm
@@ -573,17 +573,6 @@ Close @var{inferior} when done, even if @var{proc} exits non-locally."
variables to set to use the built profile. Connect to the Guix daemon specified
by @var{guix-daemon-socket}. If @var{channels} is not @code{#f}, build manifest
in a Guix inferior with @var{channels}."
- (define (build-derivation drv guix-daemon-socket)
- (if guix-daemon-socket
- (parameterize ((%daemon-socket-uri guix-daemon-socket))
- (build-derivation drv #f))
- (with-store store
- (run-with-store store
- (mlet %store-monad ((drv drv))
- (mbegin %store-monad
- (built-derivations (list drv))
- (return (derivation->output-path drv))))))))
-
(if channels
(call-with-inferior (inferior-for-channels channels)
(cut inferior-eval
@@ -620,17 +609,34 @@ in a Guix inferior with @var{channels}."
#:allow-collisions? #t)
,guix-daemon-socket))))))
<>))
- (let ((manifest (load-manifest manifest-file)))
- (map (match-lambda
- ((specification . value)
- (cons (search-path-specification-variable specification)
- value)))
- (evaluate-search-paths
- (manifest-search-paths manifest)
- (list (build-derivation
- (profile-derivation manifest
- #:allow-collisions? #t)
- guix-daemon-socket)))))))
+ (manifest->environment (load-manifest manifest-file)
+ guix-daemon-socket)))
+
+(define (manifest->environment manifest guix-daemon-socket)
+ "Build @var{manifest} and return an association list of environment
+variables to set to use the built profile. Connect to the Guix daemon specified
+by @var{guix-daemon-socket}."
+ (define (build-derivation drv guix-daemon-socket)
+ (if guix-daemon-socket
+ (parameterize ((%daemon-socket-uri guix-daemon-socket))
+ (build-derivation drv #f))
+ (with-store store
+ (run-with-store store
+ (mlet %store-monad ((drv drv))
+ (mbegin %store-monad
+ (built-derivations (list drv))
+ (return (derivation->output-path drv))))))))
+
+ (map (match-lambda
+ ((specification . value)
+ (cons (search-path-specification-variable specification)
+ value)))
+ (evaluate-search-paths
+ (manifest-search-paths manifest)
+ (list (build-derivation
+ (profile-derivation manifest
+ #:allow-collisions? #t)
+ guix-daemon-socket)))))
(define (build-command-line-tool-script name manifest-file channels cwl inputs
scratch store batch-system