summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2026-02-24 15:15:53 +0100
committerLudovic Courtès <ludo@gnu.org>2026-05-10 17:01:07 +0200
commit94ae360ab4039afc8c942e77ba495705850c1e65 (patch)
treead42cd7d964ed0e3a82b7ae2711d748473d4cfd4
parenta6f6e6c7b3354a2138b7573b352a4fa3bc6a10be (diff)
ui: ‘load*’ takes a list of modules to import.
* guix/ui.scm (load*): Change ‘module’ to ‘imports’. Define ‘user-module’. * guix/scripts/build.scm (options->things-to-build): Update to new ‘load*’ calling convention. * guix/scripts/deploy.scm (load-source-file): Likewise. * guix/scripts/environment.scm (load-manifest) (options/resolve-packages): Likewise. * guix/scripts/home.scm (process-action): Likewise. (%user-module): Rename to… (%user-modules): … this, and change to a list of module names. * guix/scripts/pack.scm (guix-pack): Update ‘load*’ calls. * guix/scripts/package.scm (load-manifest, %options): Likewise. * guix/scripts/pull.scm (channel-list): Likewise. * guix/scripts/refresh.scm (packages-from-manifest): Likewise. * guix/scripts/system.scm (%user-module): Rename to… (%user-modules): … this, and change to a list of module names. (read-operating-system): Adjust accordingly. (process-action): Likewise. * guix/scripts/weather.scm (load-manifest): Likewise. * tests/gexp.scm ("local-file, relative file name, within gexp, compiled"): Likewise. Change-Id: Ic838e66719d89de556ac0872c3ce0c8ff6de8790 Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r--guix/scripts/build.scm8
-rw-r--r--guix/scripts/deploy.scm8
-rw-r--r--guix/scripts/environment.scm9
-rw-r--r--guix/scripts/home.scm9
-rw-r--r--guix/scripts/pack.scm8
-rw-r--r--guix/scripts/package.scm8
-rw-r--r--guix/scripts/pull.scm4
-rw-r--r--guix/scripts/refresh.scm6
-rw-r--r--guix/scripts/system.scm12
-rw-r--r--guix/scripts/weather.scm6
-rw-r--r--guix/ui.scm9
-rw-r--r--tests/gexp.scm7
12 files changed, 49 insertions, 45 deletions
diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index dfc37d01d8..c67c4e0663 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012-2024 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012-2024, 2026 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
@@ -703,7 +703,7 @@ values.")))))))))
(loop tail 'regular
(append (append-map
for-type
- (ensure-list (load* file (make-user-module '()))))
+ (ensure-list (load* file '())))
result))))
(('manifest . manifest)
;; Otherwise '--system' is ignored.
@@ -715,8 +715,8 @@ values.")))))))))
(manifest-entries
(ensure-manifest
(load* manifest
- (make-user-module '((guix profiles)
- (gnu))))
+ '((guix profiles)
+ (gnu)))
manifest)))
result))))
(('expression . str)
diff --git a/guix/scripts/deploy.scm b/guix/scripts/deploy.scm
index e2ef0006e0..f1df8bd5e9 100644
--- a/guix/scripts/deploy.scm
+++ b/guix/scripts/deploy.scm
@@ -1,7 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019 David Thompson <davet@gnu.org>
;;; Copyright © 2019 Jakob L. Kreuze <zerodaysfordays@sdf.org>
-;;; Copyright © 2020-2022 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2020-2022, 2026 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2024 Richard Sent <richard@freakingpenguin.com>
;;; Copyright © 2025 Arun Isaac <arunisaac@systemreboot.net>
;;;
@@ -120,9 +120,9 @@ Perform the deployment specified by FILE.\n"))
"Load FILE as a user module."
(let* ((guix-path (dirname (search-path %load-path "guix.scm")))
(environment-modules (scheme-modules* guix-path "gnu/machine"))
- (module (make-user-module (append '((gnu) (gnu machine))
- environment-modules))))
- (load* file module)))
+ (modules (append '((gnu) (gnu machine))
+ environment-modules)))
+ (load* file modules)))
(define* (show-what-to-deploy machines #:key (dry-run? #f) (roll-back? #f))
"Show the list of machines in MACHINES to deploy or roll back."
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index 8e5d76bce7..dc7f3b9b28 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014, 2015, 2018 David Thompson <davet@gnu.org>
-;;; Copyright © 2015-2025 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015-2026 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2018 Mike Gerwitz <mtg@gnu.org>
;;; Copyright © 2022, 2023 John Kehayias <john.kehayias@protonmail.com>
;;;
@@ -319,8 +319,8 @@ use '--preserve' instead~%"))
(define (load-manifest file) ;TODO: factorize
"Load the user-profile manifest (Scheme code) from FILE and return it."
- (let ((user-module (make-user-module '((guix profiles) (gnu)))))
- (load* file user-module)))
+ (let ((modules '((guix profiles) (gnu))))
+ (load* file modules)))
(define (options/resolve-packages store opts)
"Return OPTS with package specification strings replaced by manifest entries
@@ -369,8 +369,7 @@ for the corresponding packages."
(packages->outputs (read/eval str) mode))
(('load mode file)
;; Add all the outputs of the package defined in FILE.
- (let ((module (make-user-module '())))
- (packages->outputs (load* file module) mode)))
+ (packages->outputs (load* file '()) mode))
(('manifest . file)
(manifest-entries (load-manifest file)))
(('nesting? . #t)
diff --git a/guix/scripts/home.scm b/guix/scripts/home.scm
index 7499736e66..6f791c7cc5 100644
--- a/guix/scripts/home.scm
+++ b/guix/scripts/home.scm
@@ -3,7 +3,7 @@
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
;;; Copyright © 2021 Oleg Pykhalov <go.wigust@gmail.com>
-;;; Copyright © 2022-2023, 2025 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2022-2023, 2025-2026 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net>
;;; Copyright © 2022 Antero Mejr <antero@mailbox.org>
;;;
@@ -88,8 +88,9 @@
;;; Options.
;;;
-(define %user-module
- (make-user-module '((gnu home))))
+(define %user-modules
+ ;; List of modules visible when loading Home environments.
+ '((gnu home)))
(define %guix-home
(string-append %profile-directory "/guix-home"))
@@ -534,7 +535,7 @@ resulting from command-line parsing."
(expr
(read/eval expr))
(file
- (load* file %user-module
+ (load* file %user-modules
#:on-error (assoc-ref opts 'on-error)))
(else
(leave (G_ "no configuration specified~%")))))))
diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index 0b78f07077..1536e913bf 100644
--- a/guix/scripts/pack.scm
+++ b/guix/scripts/pack.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2015, 2017-2024 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015, 2017-2024, 2026 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2018 Konrad Hinsen <konrad.hinsen@fastmail.net>
;;; Copyright © 2018 Chris Marusich <cmmarusich@gmail.com>
@@ -1720,7 +1720,7 @@ Create a bundle of PACKAGE.\n"))
(let ((file (or (and (string-suffix? ".json" file)
(json->scheme-file file))
file)))
- (load* file (make-user-module '()))))
+ (load* file '())))
(x #f)))
(define (manifest-from-args store opts)
@@ -1756,9 +1756,7 @@ Create a bundle of PACKAGE.\n"))
((not (null? manifests))
(concatenate-manifests
(map (lambda (file)
- (let ((user-module (make-user-module
- '((guix profiles) (gnu)))))
- (load* file user-module)))
+ (load* file '((guix profiles) (gnu))))
manifests)))
(else
(packages->manifest packages
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 9d99b2a55b..0a9e087c66 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012-2023 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012-2023, 2026 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2013, 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2014, 2016 Alex Kost <alezost@gmail.com>
@@ -529,7 +529,7 @@ Install, remove, or upgrade packages in a single transaction.\n"))
(let ((file (or (and (string-suffix? ".json" arg)
(json->scheme-file arg))
arg)))
- (load* file (make-user-module '())))
+ (load* file '()))
result)
#f)))
(option '(#\r "remove") #f #t
@@ -972,8 +972,8 @@ processed, #f otherwise."
(define (load-manifest file)
"Load the user-profile manifest (Scheme code) from FILE and return it."
- (let ((user-module (make-user-module '((guix profiles) (gnu)))))
- (load* file user-module)))
+ (let ((modules '((guix profiles) (gnu))))
+ (load* file modules)))
(define %actions
;; List of actions that may be processed. The car of each pair is the
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 70141e2d63..7b04c05d0b 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013-2015, 2017-2024 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013-2015, 2017-2024, 2026 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2020, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
;;;
@@ -724,7 +724,7 @@ transformations specified in OPTS (resulting from '--url', '--commit', or
(string-append %sysconfdir "/guix/channels.scm"))
(define (load-channels file)
- (let ((result (load* file (make-user-module '((guix channels))))))
+ (let ((result (load* file '((guix channels)))))
(if (and (list? result) (every channel? result))
result
(leave (G_ "'~a' did not return a list of channels~%") file))))
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index 65654863cc..60fba71c3e 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013-2023 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013-2023, 2026 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2015 Alex Kost <alezost@gmail.com>
@@ -546,8 +546,8 @@ all are dependent packages: ~{~a~^ ~}~%")
(define (packages-from-manifest manifest)
"Return the list of packages in loaded MANIFEST."
- (let* ((user-module (make-user-module '((guix profiles) (gnu))))
- (manifest (load* manifest user-module)))
+ (let* ((modules '((guix profiles) (gnu)))
+ (manifest (load* manifest modules)))
(manifest->packages manifest)))
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index eddc2fc3e3..3ffa067b32 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -103,16 +103,16 @@
;;; Operating system declaration.
;;;
-(define %user-module
+(define %user-modules
;; Module in which the machine description file is loaded.
- (make-user-module '((gnu system)
- (gnu services)
- (gnu system shadow))))
+ '((gnu system)
+ (gnu services)
+ (gnu system shadow)))
;; Note: The procedure below is used in external projects such as Emacs-Guix.
(define (read-operating-system file)
"Read the operating-system declaration from FILE and return it."
- (load* file %user-module))
+ (load* file %user-modules))
;;;
@@ -1301,7 +1301,7 @@ resulting from command-line parsing."
(expr
(read/eval expr))
(file
- (load* file %user-module
+ (load* file %user-modules
#:on-error (assoc-ref opts 'on-error)))
(else
(leave (G_ "no configuration specified~%")))))))
diff --git a/guix/scripts/weather.scm b/guix/scripts/weather.scm
index 74fd3cac04..b55ae338e2 100644
--- a/guix/scripts/weather.scm
+++ b/guix/scripts/weather.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2017-2024 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2017-2024, 2026 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2018 Kyle Meyer <kyle@kyleam.com>
;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
@@ -431,8 +431,8 @@ Report the availability of substitutes.\n"))
(define (load-manifest file)
"Load the manifest from FILE and return the list of packages it refers to."
- (let* ((user-module (make-user-module '((guix profiles) (gnu))))
- (manifest (load* file user-module)))
+ (let* ((modules '((guix profiles) (gnu)))
+ (manifest (load* file modules)))
(delete-duplicates (map manifest-entry-item
(manifest-transitive-entries manifest))
eq?)))
diff --git a/guix/ui.scm b/guix/ui.scm
index f5c6a1af10..054bbe7935 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -222,7 +222,7 @@ symlink to a non-existent file like 'pipe:[1234]', as in this example:
(canonicalize-path file))
(const file)))
-(define* (load* file user-module
+(define* (load* file imports
#:key (on-error 'nothing-special))
"Load the user provided Scheme source code FILE."
(define (error-string frame args)
@@ -233,6 +233,13 @@ symlink to a non-existent file like 'pipe:[1234]', as in this example:
(define tag
(make-prompt-tag "user-code"))
+ (define user-module
+ (if (module? imports)
+ (begin
+ (warning (G_ "using deprecated calling convention of 'load*'~%"))
+ imports)
+ (make-user-module imports)))
+
(catch #t
(lambda ()
;; XXX: Force a recompilation to avoid ABI issues.
diff --git a/tests/gexp.scm b/tests/gexp.scm
index ddb9904fef..bc75d479b4 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014-2025 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014-2026 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2021-2022 Maxime Devos <maximedevos@telenet.be>
;;; Copyright © 2026 David Elsing <david.elsing@posteo.net>
;;;
@@ -281,11 +281,10 @@
(basename file) "\" \"t.scm\"))")
port)))
- (let* ((interned (add-to-store %store "t.scm" #f "sha256" file))
- (module (make-fresh-user-module)))
+ (let* ((interned (add-to-store %store "t.scm" #f "sha256" file)))
(module-use! module (resolve-interface '(guix gexp)))
(equal? `(this file is ,interned)
- (gexp->sexp* (load* file module))))))
+ (gexp->sexp* (load* file '()))))))
(test-assertm "local-file, #:select?"
(mlet* %store-monad ((select? -> (lambda (file stat)