From 15f87a0f037ec9b4f5045965416652670ffd955f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 14 Dec 2025 23:37:13 +0100 Subject: describe: Define and use ‘modules-from-current-profile’. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes . Fixes a bug whereby bootloader, image, platform, etc. modules would be searched for in locations other than the current profile, possibly leading to incompatible files being loaded. More generally, this bug would break statelessness: depending on what happens to be available in $GUILE_LOAD_PATH, some modules would or would not be loaded. * guix/describe.scm (modules-from-current-profile): New procedure. * gnu/bootloader.scm (bootloader-modules): Use it instead of ‘all-modules’. * gnu/system/image.scm (image-modules): Likewise. (not-config?): Rename to… (neither-config-nor-git?): … this, and add (guix git). Adjust users. * guix/import/utils.scm (build-system-modules): Likewise. * guix/platform.scm (platform-modules): Likewise. * guix/upstream.scm (importer-modules): Likewise. Change-Id: I8ac55a5bcdf54990665c70d0aa558b9b2c2548d4 Signed-off-by: Ludovic Courtès Merges: #4859 Signed-off-by: Rutherther --- gnu/system/image.scm | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/image.scm b/gnu/system/image.scm index ac0706aa0f1..fb0ba287730 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -25,7 +25,8 @@ (define-module (gnu system image) #:use-module (guix deprecation) #:use-module (guix diagnostics) - #:use-module (guix discovery) + #:autoload (guix discovery) (fold-module-public-variables) + #:autoload (guix describe) (modules-from-current-profile) #:use-module (guix gexp) #:use-module (guix modules) #:use-module (guix monads) @@ -315,10 +316,14 @@ set to the given OS." ;; Helpers. ;; -(define not-config? - ;; Select (guix …) and (gnu …) modules, except (guix config). +(define neither-config-nor-git? + ;; Select (guix …) and (gnu …) modules, except (guix config) and (guix git). + ;; The latter is autoloaded by some modules but it is not supposed to be + ;; actually used in the context of image creation; adding it to the module + ;; closure would imply adding Guile-Git as well. (match-lambda (('guix 'config) #f) + (('guix 'git) #f) (('guix rest ...) #t) (('gnu rest ...) #t) (rest #f))) @@ -352,7 +357,7 @@ set to the given OS." (gnu build hurd-boot) (gnu build linux-boot) (guix store database)) - #:select? not-config?) + #:select? neither-config-nor-git?) ((guix config) => ,(make-config.scm))) #~(begin (use-modules (gnu build image) @@ -786,7 +791,7 @@ output file." (guix build utils) (guix build store-copy) (gnu build image)) - #:select? not-config?) + #:select? neither-config-nor-git?) ((guix config) => ,(make-config.scm))) #~(begin (use-modules (guix docker) @@ -880,7 +885,7 @@ output file." (guix build utils) (guix store database) (gnu build image)) - #:select? not-config?) + #:select? neither-config-nor-git?) ((guix config) => ,(make-config.scm))) #~(begin (use-modules (guix build pack) @@ -1137,10 +1142,8 @@ image, depending on IMAGE format." (define (image-modules) "Return the list of image modules." (cons (resolve-interface '(gnu system image)) - (all-modules (map (lambda (entry) - `(,entry . "gnu/system/images/")) - %load-path) - #:warn warn-about-load-error))) + (modules-from-current-profile "gnu/system/images" + #:warn warn-about-load-error))) (define %image-types ;; The list of publically-known image types. -- cgit v1.3