summaryrefslogtreecommitdiff
path: root/gnu/system
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2025-12-14 23:37:13 +0100
committerRutherther <rutherther@ditigal.xyz>2026-01-25 21:17:44 +0100
commit15f87a0f037ec9b4f5045965416652670ffd955f (patch)
treef41eaa2b25c4851f2fc5634411d5ddb9202aa03a /gnu/system
parent4fa29f3bed9b8e5f7a385e242491873c6ab66fa8 (diff)
describe: Define and use ‘modules-from-current-profile’.
Fixes <https://issues.guix.gnu.org/75458>. 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 <ludo@gnu.org> Merges: #4859 Signed-off-by: Rutherther <rutherther@ditigal.xyz>
Diffstat (limited to 'gnu/system')
-rw-r--r--gnu/system/image.scm23
1 files changed, 13 insertions, 10 deletions
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 @@
25(define-module (gnu system image) 25(define-module (gnu system image)
26 #:use-module (guix deprecation) 26 #:use-module (guix deprecation)
27 #:use-module (guix diagnostics) 27 #:use-module (guix diagnostics)
28 #:use-module (guix discovery) 28 #:autoload (guix discovery) (fold-module-public-variables)
29 #:autoload (guix describe) (modules-from-current-profile)
29 #:use-module (guix gexp) 30 #:use-module (guix gexp)
30 #:use-module (guix modules) 31 #:use-module (guix modules)
31 #:use-module (guix monads) 32 #:use-module (guix monads)
@@ -315,10 +316,14 @@ set to the given OS."
315;; Helpers. 316;; Helpers.
316;; 317;;
317 318
318(define not-config? 319(define neither-config-nor-git?
319 ;; Select (guix …) and (gnu …) modules, except (guix config). 320 ;; Select (guix …) and (gnu …) modules, except (guix config) and (guix git).
321 ;; The latter is autoloaded by some modules but it is not supposed to be
322 ;; actually used in the context of image creation; adding it to the module
323 ;; closure would imply adding Guile-Git as well.
320 (match-lambda 324 (match-lambda
321 (('guix 'config) #f) 325 (('guix 'config) #f)
326 (('guix 'git) #f)
322 (('guix rest ...) #t) 327 (('guix rest ...) #t)
323 (('gnu rest ...) #t) 328 (('gnu rest ...) #t)
324 (rest #f))) 329 (rest #f)))
@@ -352,7 +357,7 @@ set to the given OS."
352 (gnu build hurd-boot) 357 (gnu build hurd-boot)
353 (gnu build linux-boot) 358 (gnu build linux-boot)
354 (guix store database)) 359 (guix store database))
355 #:select? not-config?) 360 #:select? neither-config-nor-git?)
356 ((guix config) => ,(make-config.scm))) 361 ((guix config) => ,(make-config.scm)))
357 #~(begin 362 #~(begin
358 (use-modules (gnu build image) 363 (use-modules (gnu build image)
@@ -786,7 +791,7 @@ output file."
786 (guix build utils) 791 (guix build utils)
787 (guix build store-copy) 792 (guix build store-copy)
788 (gnu build image)) 793 (gnu build image))
789 #:select? not-config?) 794 #:select? neither-config-nor-git?)
790 ((guix config) => ,(make-config.scm))) 795 ((guix config) => ,(make-config.scm)))
791 #~(begin 796 #~(begin
792 (use-modules (guix docker) 797 (use-modules (guix docker)
@@ -880,7 +885,7 @@ output file."
880 (guix build utils) 885 (guix build utils)
881 (guix store database) 886 (guix store database)
882 (gnu build image)) 887 (gnu build image))
883 #:select? not-config?) 888 #:select? neither-config-nor-git?)
884 ((guix config) => ,(make-config.scm))) 889 ((guix config) => ,(make-config.scm)))
885 #~(begin 890 #~(begin
886 (use-modules (guix build pack) 891 (use-modules (guix build pack)
@@ -1137,10 +1142,8 @@ image, depending on IMAGE format."
1137(define (image-modules) 1142(define (image-modules)
1138 "Return the list of image modules." 1143 "Return the list of image modules."
1139 (cons (resolve-interface '(gnu system image)) 1144 (cons (resolve-interface '(gnu system image))
1140 (all-modules (map (lambda (entry) 1145 (modules-from-current-profile "gnu/system/images"
1141 `(,entry . "gnu/system/images/")) 1146 #:warn warn-about-load-error)))
1142 %load-path)
1143 #:warn warn-about-load-error)))
1144 1147
1145(define %image-types 1148(define %image-types
1146 ;; The list of publically-known image types. 1149 ;; The list of publically-known image types.