diff mbox series

[bug#50960,v2,07/11] environment: Skip derivation computation when '--profile' is used.

Message ID 20211011213809.17482-8-ludo@gnu.org
State New
Headers show
Series 'guix shell' strikes again | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Ludovic Courtès Oct. 11, 2021, 9:38 p.m. UTC
* guix/scripts/environment.scm (guix-environment*): Bypass calls to
'package-derivation' and to 'manifest->derivation' when PROFILE is
true.
---
 guix/scripts/environment.scm | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index 77956fc018..32f376fdd2 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -729,18 +729,21 @@  (define manifest
             ;; Use the bootstrap Guile when requested.
             (parameterize ((%graft? (assoc-ref opts 'graft?))
                            (%guile-for-build
-                            (package-derivation
-                             store
-                             (if bootstrap?
-                                 %bootstrap-guile
-                                 (default-guile)))))
+                            (and (or container? (not profile))
+                                 (package-derivation
+                                  store
+                                  (if bootstrap?
+                                      %bootstrap-guile
+                                      (default-guile))))))
               (run-with-store store
                 ;; Containers need a Bourne shell at /bin/sh.
                 (mlet* %store-monad ((bash       (environment-bash container?
                                                                    bootstrap?
                                                                    system))
-                                     (prof-drv   (manifest->derivation
-                                                  manifest system bootstrap?))
+                                     (prof-drv   (if profile
+                                                     (return #f)
+                                                     (manifest->derivation
+                                                      manifest system bootstrap?)))
                                      (profile -> (if profile
                                                      (readlink* profile)
                                                      (derivation->output-path prof-drv)))
@@ -750,9 +753,9 @@  (define manifest
                   ;; --search-paths.  Additionally, we might need to build bash for
                   ;; a container.
                   (mbegin %store-monad
-                    (built-derivations (if (derivation? bash)
-                                           (list prof-drv bash)
-                                           (list prof-drv)))
+                    (built-derivations (append
+                                           (if prof-drv (list prof-drv) '())
+                                           (if (derivation? bash) (list bash) '())))
                     (mwhen gc-root
                       (register-gc-root profile gc-root))