environment: Really auto-load (guix scripts pack).

Fixes a performance regression on cache hits introduced in
b31ea797ed, whereby (guix scripts pack)
would be loaded eagerly during startup, leading hundreds of (gnu
packages *) modules to be loaded.

Fixes <https://issues.guix.gnu.org/62899>.

* guix/scripts/environment.scm: Autoload (gnu build install).
(%options): Add indirection when calling 'symlink-spec-option-parser' so
that (guix scripts pack) is auto-loaded only when needed.
This commit is contained in:
Ludovic Courtès 2023-04-17 14:32:24 +02:00
parent 63500cbbee
commit 9fad6067d9
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -38,7 +38,7 @@ (define-module (guix scripts environment)
#:autoload (guix scripts pack) (symlink-spec-option-parser)
#:use-module (guix transformations)
#:autoload (ice-9 ftw) (scandir)
#:use-module (gnu build install)
#:autoload (gnu build install) (evaluate-populate-directive)
#:autoload (gnu build linux-container) (call-with-container %namespaces
user-namespace-supported?
unprivileged-user-namespace-supported?
@ -271,7 +271,11 @@ (define %options
(alist-cons 'file-system-mapping
(specification->file-system-mapping arg #f)
result)))
(option '(#\S "symlink") #t #f symlink-spec-option-parser)
(option '(#\S "symlink") #t #f
(lambda (opt name arg result)
;; Delay call to avoid auto-loading (guix scripts pack)
;; when unnecessary.
(symlink-spec-option-parser opt name arg result)))
(option '(#\r "root") #t #f
(lambda (opt name arg result)
(alist-cons 'gc-root arg result)))