aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2022-04-09 00:43:52 +0530
committerArun Isaac2022-04-09 10:55:08 +0530
commit0289a3a512fa745a7476be9f042769ad6a29c2a9 (patch)
tree258bf7c0b26a5069499133e84a8e0d301da83cbe
parent65a2b4c7c7818d1ddfc47feacaca452844be3c0b (diff)
downloadguix-forge-0289a3a512fa745a7476be9f042769ad6a29c2a9.tar.gz
guix-forge-0289a3a512fa745a7476be9f042769ad6a29c2a9.tar.lz
guix-forge-0289a3a512fa745a7476be9f042769ad6a29c2a9.zip
utils: Implement with-packages using with-manifest.
* guix/forge/utils.scm (profile-with-packages, environment-with-packages): Delete functions. (with-packages): Implement in terms of with-manifest.
-rw-r--r--guix/forge/utils.scm39
1 files changed, 2 insertions, 37 deletions
diff --git a/guix/forge/utils.scm b/guix/forge/utils.scm
index f23f763..96d9f51 100644
--- a/guix/forge/utils.scm
+++ b/guix/forge/utils.scm
@@ -60,44 +60,9 @@ MANIFEST."
;; Run the provided expression.
#$exp)))
-(define (profile-with-packages packages)
- "Return profile with PACKAGES."
- (with-store store
- (run-with-store store
- (mlet* %store-monad ((prof-drv (profile-derivation
- (packages->manifest packages)))
- (profile -> (derivation->output-path prof-drv)))
- (mbegin %store-monad
- (built-derivations (list prof-drv))
- (return profile))))))
-
-(define (environment-with-packages packages)
- "Return environment of a profile with PACKAGES. Return value is an
-association list mapping the name of an environment variable to its
-value."
- (map (match-lambda
- ((search-path . value)
- (cons (search-path-specification-variable search-path)
- value)))
- (profile-search-paths (profile-with-packages packages))))
-
(define (with-packages packages exp)
"Return a gexp executing EXP, another gexp, in an environment where
PACKAGES are available and their search path environment variables
have been set."
- #~(begin
- ;; Add a reference to the profile.
- #$(profile-with-packages packages)
- ;; Set the environment.
- ;; We pull out match-lambda using module-ref instead of using
- ;; use-modules because this gexp will be substituted into other
- ;; gexps and use-modules only works at the top-level.
- (let-syntax ((match-lambda (macro-transformer
- (module-ref (resolve-module '(ice-9 match))
- 'match-lambda))))
- (for-each (match-lambda
- ((variable . value)
- (setenv variable value)))
- '#$(environment-with-packages packages)))
- ;; Run the provided expression.
- #$exp))
+ (with-manifest (packages->manifest packages)
+ exp))