environment: Skip derivation computation when '--profile' is used.

* guix/scripts/environment.scm (guix-environment*): Bypass calls to
'package-derivation' and to 'manifest->derivation' when PROFILE is
true.
This commit is contained in:
Ludovic Courtès 2021-10-01 18:59:54 +02:00
parent 10208952ea
commit 648a6eb03f
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -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))