Ping ;)

Next steps here?

I can resubmit a clean 68315 with this change too if this helps.

In the previous mail response, I made the point that 68315 is probably a
requirement for the following patch to be actually useful.

Cheers,

Nicolas

On 2025-04-26 01:12, Nicolas Graves wrote:

> attached is the reworked patch (only modules / no imported-modules
> addition, no standardization efforts, no default).
>
> Do two with-imported-modules build-upon each other? If I wrap a gexp in
> with-imported-modules, do that act like if we had with-imported-modules
> with the union of modules?
>
> From 9895ecb13110bcfaec189d3e029566d060d69889 Mon Sep 17 00:00:00 2001
> Message-ID: 
> <9895ecb13110bcfaec189d3e029566d060d69889.1745622542.git.ngra...@ngraves.fr>
> From: Nicolas Graves <ngra...@ngraves.fr>
> Date: Tue, 18 Mar 2025 06:13:05 +0100
> Subject: [PATCH] build-system: Add modules field.
>
> ---
>  gnu/packages/bootstrap.scm         |  3 ++-
>  guix/build-system.scm              | 11 +++++++----
>  guix/build-system/agda.scm         |  6 +++---
>  guix/build-system/android-ndk.scm  |  8 ++++----
>  guix/build-system/ant.scm          | 10 +++++-----
>  guix/build-system/asdf.scm         | 13 +++++++------
>  guix/build-system/cargo.scm        | 14 ++++++--------
>  guix/build-system/channel.scm      |  1 +
>  guix/build-system/chicken.scm      | 10 +++++-----
>  guix/build-system/clojure.scm      |  6 +++---
>  guix/build-system/cmake.scm        | 10 ++++------
>  guix/build-system/composer.scm     |  8 ++++----
>  guix/build-system/copy.scm         |  8 ++++----
>  guix/build-system/dub.scm          |  8 ++++----
>  guix/build-system/dune.scm         |  8 ++++----
>  guix/build-system/elm.scm          |  6 +++---
>  guix/build-system/emacs.scm        |  8 ++++----
>  guix/build-system/font.scm         |  8 ++++----
>  guix/build-system/glib-or-gtk.scm  |  7 +++----
>  guix/build-system/gnu.scm          |  7 +++----
>  guix/build-system/go.scm           | 13 +++++--------
>  guix/build-system/guile.scm        | 10 ++++------
>  guix/build-system/haskell.scm      |  8 ++++----
>  guix/build-system/julia.scm        |  8 ++++----
>  guix/build-system/linux-module.scm | 14 ++++++--------
>  guix/build-system/maven.scm        | 10 +++++-----
>  guix/build-system/meson.scm        | 10 ++++------
>  guix/build-system/minetest.scm     |  1 +
>  guix/build-system/minify.scm       |  8 ++++----
>  guix/build-system/mix.scm          |  8 ++++----
>  guix/build-system/mozilla.scm      |  1 +
>  guix/build-system/node.scm         |  8 ++++----
>  guix/build-system/ocaml.scm        |  8 ++++----
>  guix/build-system/perl.scm         | 15 ++++++---------
>  guix/build-system/pyproject.scm    |  6 +++---
>  guix/build-system/python.scm       |  6 +++---
>  guix/build-system/qt.scm           | 10 ++++------
>  guix/build-system/r.scm            |  8 ++++----
>  guix/build-system/rakudo.scm       |  8 ++++----
>  guix/build-system/rebar.scm        |  8 ++++----
>  guix/build-system/renpy.scm        |  8 ++++----
>  guix/build-system/ruby.scm         |  8 ++++----
>  guix/build-system/scons.scm        |  7 ++++---
>  guix/build-system/texlive.scm      | 10 +++++-----
>  guix/build-system/tree-sitter.scm  | 15 ++++++---------
>  guix/build-system/trivial.scm      |  5 +++--
>  guix/build-system/vim.scm          |  8 ++++----
>  guix/build-system/waf.scm          |  8 ++++----
>  guix/build-system/zig.scm          | 14 ++++++--------
>  49 files changed, 198 insertions(+), 213 deletions(-)
>
> diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
> index 79ef8a5f412..781a9d0c35d 100644
> --- a/gnu/packages/bootstrap.scm
> +++ b/gnu/packages/bootstrap.scm
> @@ -570,7 +570,7 @@ (define (make-guile-wrapper bash guile-real)
>  
>  (define* (make-raw-bag name
>                         #:key source inputs native-inputs outputs
> -                       system target)
> +                       system target #:allow-other-keys)
>    (bag
>      (name name)
>      (system system)
> @@ -590,6 +590,7 @@ (define %bootstrap-guile
>    (let ((raw (build-system
>                 (name 'raw)
>                 (description "Raw build system with direct store access")
> +               (modules '())
>                 (lower make-raw-bag))))
>     (package
>       (name "guile-bootstrap")
> diff --git a/guix/build-system.scm b/guix/build-system.scm
> index a4dcdc52d85..45c2caf49cb 100644
> --- a/guix/build-system.scm
> +++ b/guix/build-system.scm
> @@ -24,6 +24,7 @@ (define-module (guix build-system)
>              build-system?
>              build-system-name
>              build-system-description
> +            build-system-modules
>              build-system-lower
>  
>              bag
> @@ -44,9 +45,10 @@ (define-module (guix build-system)
>  
>  (define-record-type* <build-system> build-system make-build-system
>    build-system?
> -  (name        build-system-name)         ; symbol
> -  (description build-system-description)  ; short description
> -  (lower       build-system-lower))       ; args ... -> bags
> +  (name                     build-system-name)         ; symbol
> +  (description              build-system-description)  ; short description
> +  (modules                  build-system-modules)      ; modules sexp
> +  (lower                    build-system-lower))       ; args ... -> bags
>  
>  ;; "Bags" are low-level representations of "packages".  The system and target
>  ;; of a bag is fixed when it's created.  This is because build systems may
> @@ -92,8 +94,9 @@ (define* (make-bag build-system name
>  This is the mechanism by which a package is \"lowered\" to a bag, which is 
> the
>  intermediate representation just above derivations."
>    (match build-system
> -    (($ <build-system> _ description lower)
> +    (($ <build-system> _ description modules lower)
>       (apply lower name
> +            #:modules modules
>              #:system system
>              #:source source
>              #:inputs inputs
> diff --git a/guix/build-system/agda.scm b/guix/build-system/agda.scm
> index ec6ad860e08..b54a5bd6af9 100644
> --- a/guix/build-system/agda.scm
> +++ b/guix/build-system/agda.scm
> @@ -76,7 +76,7 @@ (define private-keywords
>  
>  (define* (agda-build name inputs
>                       #:key
> -                     source
> +                     modules source
>                       (phases '%standard-phases)
>                       (outputs '("out"))
>                       (search-paths '())
> @@ -87,8 +87,7 @@ (define* (agda-build name inputs
>                       (guile #f)
>                       plan
>                       (extra-files '("^\\./.*\\.agda-lib$"))
> -                     (imported-modules %agda-build-system-modules)
> -                     (modules %default-modules))
> +                     (imported-modules %agda-build-system-modules))
>    (define builder
>      (with-imported-modules imported-modules
>        #~(begin
> @@ -119,4 +118,5 @@ (define agda-build-system
>      (name 'agda)
>      (description
>       "Build system for Agda libraries")
> +    (modules %default-modules)
>      (lower lower)))
> diff --git a/guix/build-system/android-ndk.scm 
> b/guix/build-system/android-ndk.scm
> index b8cd56b8719..899773ee48f 100644
> --- a/guix/build-system/android-ndk.scm
> +++ b/guix/build-system/android-ndk.scm
> @@ -35,7 +35,7 @@ (define %android-ndk-build-system-modules
>  
>  (define* (android-ndk-build name inputs
>                              #:key
> -                            source
> +                            modules source
>                              (tests? #t)
>                              (test-target #f)
>                              (phases '%standard-phases)
> @@ -44,9 +44,7 @@ (define* (android-ndk-build name inputs
>                              (search-paths '())
>                              (system (%current-system))
>                              (guile #f)
> -                            (imported-modules 
> %android-ndk-build-system-modules)
> -                            (modules '((guix build android-ndk-build-system)
> -                                       (guix build utils))))
> +                            (imported-modules 
> %android-ndk-build-system-modules))
>    "Build SOURCE using Android NDK, and with INPUTS."
>    (define builder
>      (with-imported-modules imported-modules
> @@ -112,4 +110,6 @@ (define android-ndk-build-system
>      (name 'android-ndk)
>      (description
>       "Android NDK build system, to build Android NDK packages")
> +    (modules '((guix build android-ndk-build-system)
> +               (guix build utils)))
>      (lower lower)))
> diff --git a/guix/build-system/ant.scm b/guix/build-system/ant.scm
> index 9816cc061c9..02e40aabe68 100644
> --- a/guix/build-system/ant.scm
> +++ b/guix/build-system/ant.scm
> @@ -95,7 +95,7 @@ (define private-keywords
>  
>  (define* (ant-build name inputs
>                      #:key
> -                    source
> +                    modules source
>                      (tests? #t)
>                      (test-target "check")
>                      (configure-flags ''())
> @@ -113,10 +113,7 @@ (define* (ant-build name inputs
>                      (search-paths '())
>                      (system (%current-system))
>                      (guile #f)
> -                    (imported-modules %ant-build-system-modules)
> -                    (modules '((guix build ant-build-system)
> -                               (guix build java-utils)
> -                               (guix build utils))))
> +                    (imported-modules %ant-build-system-modules))
>    "Build SOURCE with INPUTS."
>    (define builder
>      (with-imported-modules imported-modules
> @@ -154,6 +151,9 @@ (define ant-build-system
>    (build-system
>      (name 'ant)
>      (description "The standard Ant build system")
> +    (modules '((guix build ant-build-system)
> +               (guix build java-utils)
> +               (guix build utils)))
>      (lower lower)))
>  
>  ;;; ant.scm ends here
> diff --git a/guix/build-system/asdf.scm b/guix/build-system/asdf.scm
> index ad0fb993f69..1f6c91e7c45 100644
> --- a/guix/build-system/asdf.scm
> +++ b/guix/build-system/asdf.scm
> @@ -94,13 +94,12 @@ (define private-keywords
>           (arguments (strip-keyword-arguments private-keywords arguments)))))
>  
>  (define* (asdf-build/source name inputs
> -                            #:key source outputs
> +                            #:key modules source outputs
>                              (phases '%standard-phases/source)
>                              (search-paths '())
>                              (system (%current-system))
>                              (guile #f)
> -                            (imported-modules %asdf-build-system-modules)
> -                            (modules %asdf-build-modules))
> +                            (imported-modules %asdf-build-system-modules))
>    (define builder
>      (with-imported-modules imported-modules
>        #~(begin
> @@ -271,7 +270,7 @@ (define private-keywords
>  
>  (define (asdf-build lisp-type)
>    (lambda* (name inputs
> -                 #:key source outputs
> +                 #:key modules source outputs
>                   (tests? #t)
>                   (asd-systems ''())
>                   (asd-test-systems ''())
> @@ -280,8 +279,7 @@ (define (asdf-build lisp-type)
>                   (search-paths '())
>                   (system (%current-system))
>                   (guile #f)
> -                 (imported-modules %asdf-build-system-modules)
> -                 (modules %asdf-build-modules))
> +                 (imported-modules %asdf-build-system-modules))
>  
>      (define systems
>        (if (null? (cadr asd-systems))
> @@ -332,18 +330,21 @@ (define asdf-build-system/sbcl
>    (build-system
>      (name 'asdf/sbcl)
>      (description "The build system for ASDF binary packages using SBCL")
> +    (modules %asdf-build-modules)
>      (lower (lower "sbcl"))))
>  
>  (define asdf-build-system/ecl
>    (build-system
>      (name 'asdf/ecl)
>      (description "The build system for ASDF binary packages using ECL")
> +    (modules %asdf-build-modules)
>      (lower (lower "ecl"))))
>  
>  (define asdf-build-system/source
>    (build-system
>      (name 'asdf/source)
>      (description "The build system for ASDF source packages")
> +    (modules %asdf-build-modules)
>      (lower lower/source)))
>  
>  (define sbcl-package->cl-source-package
> diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm
> index 452f7f78d01..1ce40c8152e 100644
> --- a/guix/build-system/cargo.scm
> +++ b/guix/build-system/cargo.scm
> @@ -88,7 +88,7 @@ (define %cargo-build-system-modules
>  
>  (define* (cargo-build name inputs
>                        #:key
> -                      source
> +                      modules source
>                        (tests? #t)
>                        (test-target #f)
>                        (vendor-dir "guix-vendor")
> @@ -105,9 +105,7 @@ (define* (cargo-build name inputs
>                        (search-paths '())
>                        (system (%current-system))
>                        (guile #f)
> -                      (imported-modules %cargo-build-system-modules)
> -                      (modules '((guix build cargo-build-system)
> -                                 (guix build utils))))
> +                      (imported-modules %cargo-build-system-modules))
>    "Build SOURCE using CARGO, and with INPUTS."
>  
>    (define builder
> @@ -147,7 +145,7 @@ (define builder
>  
>  (define* (cargo-cross-build name
>                              #:key
> -                            source target
> +                            modules source target
>                              build-inputs target-inputs host-inputs
>                              (tests? #f)
>                              (test-target #f)
> @@ -167,9 +165,7 @@ (define* (cargo-cross-build name
>                              (native-search-paths '())
>                              (system (%current-system))
>                              (guile #f)
> -                            (imported-modules %cargo-build-system-modules)
> -                            (modules '((guix build cargo-build-system)
> -                                       (guix build utils))))
> +                            (imported-modules %cargo-build-system-modules))
>    "Cross-build SOURCE using CARGO, and with INPUTS."
>  
>    (define builder
> @@ -382,4 +378,6 @@ (define cargo-build-system
>      (name 'cargo)
>      (description
>       "Cargo build system, to build Rust crates")
> +    (modules '((guix build cargo-build-system)
> +               (guix build utils)))
>      (lower lower)))
> diff --git a/guix/build-system/channel.scm b/guix/build-system/channel.scm
> index 0607dcf4d75..59e0f78d3df 100644
> --- a/guix/build-system/channel.scm
> +++ b/guix/build-system/channel.scm
> @@ -77,5 +77,6 @@ (define channel-build-system
>                                  #:commit ,commit))))))
>      (build-system (name 'channel)
>                    (description "Turn a channel instance into a package.")
> +                  (modules '())
>                    (lower lower))))
>  
> diff --git a/guix/build-system/chicken.scm b/guix/build-system/chicken.scm
> index e6fcfa7ee30..edc0b50b28e 100644
> --- a/guix/build-system/chicken.scm
> +++ b/guix/build-system/chicken.scm
> @@ -81,7 +81,7 @@ (define private-keywords
>  
>  (define* (chicken-build name inputs
>                          #:key
> -                        source
> +                        modules source
>                          (phases '%standard-phases)
>                          (outputs '("out"))
>                          (search-paths '())
> @@ -91,10 +91,7 @@ (define* (chicken-build name inputs
>                          (tests? #t)
>                          (system (%current-system))
>                          (guile #f)
> -                        (imported-modules %chicken-build-system-modules)
> -                        (modules '((guix build chicken-build-system)
> -                                   (guix build union)
> -                                   (guix build utils))))
> +                        (imported-modules %chicken-build-system-modules))
>    (define builder
>      (with-imported-modules imported-modules
>        #~(begin
> @@ -124,4 +121,7 @@ (define chicken-build-system
>      (name 'chicken)
>      (description
>       "Build system for Chicken Scheme programs")
> +    (modules '((guix build chicken-build-system)
> +               (guix build union)
> +               (guix build utils)))
>      (lower lower)))
> diff --git a/guix/build-system/clojure.scm b/guix/build-system/clojure.scm
> index 037fcaf21d9..438b791beb3 100644
> --- a/guix/build-system/clojure.scm
> +++ b/guix/build-system/clojure.scm
> @@ -103,7 +103,7 @@ (define* (lower name
>  
>  (define* (clojure-build name inputs
>                          #:key
> -                        source
> +                        modules source
>                          (source-dirs `',%source-dirs)
>                          (java-source-dirs `',%java-source-dirs)
>                          (test-dirs `',%test-dirs)
> @@ -130,8 +130,7 @@ (define* (clojure-build name inputs
>                          (system (%current-system))
>                          (guile #f)
>  
> -                        (imported-modules %clojure-build-system-modules)
> -                        (modules %default-modules))
> +                        (imported-modules %clojure-build-system-modules))
>    "Build SOURCE with INPUTS."
>    (define builder
>      (with-imported-modules imported-modules
> @@ -179,6 +178,7 @@ (define clojure-build-system
>    (build-system
>      (name 'clojure)
>      (description "Simple Clojure build system using plain old 'compile'")
> +    (modules %default-modules)
>      (lower lower)))
>  
>  ;;; clojure.scm ends here
> diff --git a/guix/build-system/cmake.scm b/guix/build-system/cmake.scm
> index 9d757c0d061..abd280fe7de 100644
> --- a/guix/build-system/cmake.scm
> +++ b/guix/build-system/cmake.scm
> @@ -105,7 +105,7 @@ (define private-keywords
>      (arguments (strip-keyword-arguments private-keywords arguments))))
>  
>  (define* (cmake-build name inputs
> -                      #:key guile source
> +                      #:key guile modules source
>                        (outputs '("out")) (configure-flags ''())
>                        (search-paths '())
>                        (make-flags ''())
> @@ -123,8 +123,6 @@ (define* (cmake-build name inputs
>                        (system (%current-system))
>                        (substitutable? #t)
>                        (imported-modules %cmake-build-system-modules)
> -                      (modules '((guix build cmake-build-system)
> -                                 (guix build utils)))
>                        allowed-references
>                        disallowed-references)
>    "Build SOURCE using CMAKE, and with INPUTS. This assumes that SOURCE
> @@ -181,7 +179,7 @@ (define* (cmake-cross-build name
>                              #:key
>                              target
>                              build-inputs target-inputs host-inputs
> -                            source guile
> +                            modules source guile
>                              (outputs '("out"))
>                              (configure-flags ''())
>                              (search-paths '())
> @@ -202,8 +200,6 @@ (define* (cmake-cross-build name
>                              (system (%current-system))
>                              (build (nix-system->gnu-triplet system))
>                              (imported-modules %cmake-build-system-modules)
> -                            (modules '((guix build cmake-build-system)
> -                                       (guix build utils)))
>                              allowed-references
>                              disallowed-references)
>    "Cross-build NAME using CMAKE for TARGET, where TARGET is a GNU triplet and
> @@ -278,6 +274,8 @@ (define cmake-build-system
>    (build-system
>      (name 'cmake)
>      (description "The standard CMake build system")
> +    (modules '((guix build cmake-build-system)
> +               (guix build utils)))
>      (lower lower)))
>  
>  ;;; cmake.scm ends here
> diff --git a/guix/build-system/composer.scm b/guix/build-system/composer.scm
> index 48ad90f253e..bf951e24d02 100644
> --- a/guix/build-system/composer.scm
> +++ b/guix/build-system/composer.scm
> @@ -96,7 +96,7 @@ (define private-keywords
>  
>  (define* (composer-build name inputs
>                           #:key
> -                         guile source
> +                         guile modules source
>                           (outputs '("out"))
>                           (configure-flags ''())
>                           (search-paths '())
> @@ -115,9 +115,7 @@ (define* (composer-build name inputs
>                           (phases '(@ (guix build composer-build-system)
>                                       %standard-phases))
>                           (system (%current-system))
> -                         (imported-modules %composer-build-system-modules)
> -                         (modules '((guix build composer-build-system)
> -                                    (guix build utils))))
> +                         (imported-modules %composer-build-system-modules))
>    "Build SOURCE using PHP, and with INPUTS. This assumes that SOURCE provides
>  a 'composer.json' file as its build system."
>    (define guile-json
> @@ -161,6 +159,8 @@ (define composer-build-system
>    (build-system
>      (name 'composer)
>      (description "The standard Composer build system")
> +    (modules '((guix build composer-build-system)
> +               (guix build utils)))
>      (lower lower)))
>  
>  ;;; composer.scm ends here
> diff --git a/guix/build-system/copy.scm b/guix/build-system/copy.scm
> index 1f2937e0f18..416560b266d 100644
> --- a/guix/build-system/copy.scm
> +++ b/guix/build-system/copy.scm
> @@ -79,7 +79,7 @@ (define private-keywords
>  
>  (define* (copy-build name inputs
>                       #:key
> -                     guile source
> +                     guile modules source
>                       (outputs '("out"))
>                       (install-plan ''(("." "./")))
>                       (search-paths '())
> @@ -95,9 +95,7 @@ (define* (copy-build name inputs
>                       (system (%current-system))
>                       (target #f)
>                       (substitutable? #t)
> -                     (imported-modules %copy-build-system-modules)
> -                     (modules '((guix build copy-build-system)
> -                                (guix build utils))))
> +                     (imported-modules %copy-build-system-modules))
>    "Build SOURCE using INSTALL-PLAN, and with INPUTS."
>    (define builder
>      (with-imported-modules imported-modules
> @@ -139,6 +137,8 @@ (define copy-build-system
>    (build-system
>      (name 'copy)
>      (description "The standard copy build system")
> +    (modules '((guix build copy-build-system)
> +               (guix build utils)))
>      (lower lower)))
>  
>  ;;; copy.scm ends here
> diff --git a/guix/build-system/dub.scm b/guix/build-system/dub.scm
> index 831a34af0d1..1215c1a6ad7 100644
> --- a/guix/build-system/dub.scm
> +++ b/guix/build-system/dub.scm
> @@ -63,7 +63,7 @@ (define %dub-build-system-modules
>  
>  (define* (dub-build name inputs
>                      #:key
> -                    source
> +                    modules source
>                      (tests? #t)
>                      (test-target #f)
>                      (dub-build-flags ''())
> @@ -72,9 +72,7 @@ (define* (dub-build name inputs
>                      (search-paths '())
>                      (system (%current-system))
>                      (guile #f)
> -                    (imported-modules %dub-build-system-modules)
> -                    (modules '((guix build dub-build-system)
> -                               (guix build utils))))
> +                    (imported-modules %dub-build-system-modules))
>    "Build SOURCE using DUB, and with INPUTS."
>    (define builder
>      (with-imported-modules imported-modules
> @@ -137,4 +135,6 @@ (define dub-build-system
>      (name 'dub)
>      (description
>       "DUB build system, to build D packages")
> +    (modules '((guix build dub-build-system)
> +               (guix build utils)))
>      (lower lower)))
> diff --git a/guix/build-system/dune.scm b/guix/build-system/dune.scm
> index c45f3083493..45535511c7b 100644
> --- a/guix/build-system/dune.scm
> +++ b/guix/build-system/dune.scm
> @@ -96,7 +96,7 @@ (define private-keywords
>  
>  (define* (dune-build name inputs
>                       #:key
> -                     guile source
> +                     guile modules source
>                       (outputs '("out"))
>                       (search-paths '())
>                       (build-flags ''())
> @@ -116,9 +116,7 @@ (define* (dune-build name inputs
>                       (phases '(@ (guix build dune-build-system)
>                                   %standard-phases))
>                       (system (%current-system))
> -                     (imported-modules %dune-build-system-modules)
> -                     (modules '((guix build dune-build-system)
> -                                (guix build utils))))
> +                     (imported-modules %dune-build-system-modules))
>    "Build SOURCE using OCAML, and with INPUTS. This assumes that SOURCE
>  provides a 'setup.ml' file as its build system."
>    (define builder
> @@ -162,6 +160,8 @@ (define dune-build-system
>    (build-system
>      (name 'dune)
>      (description "The standard Dune build system")
> +    (modules '((guix build dune-build-system)
> +               (guix build utils)))
>      (lower lower)))
>  
>  ;;; dune.scm ends here
> diff --git a/guix/build-system/elm.scm b/guix/build-system/elm.scm
> index 7405db3d985..f7ffd43db31 100644
> --- a/guix/build-system/elm.scm
> +++ b/guix/build-system/elm.scm
> @@ -169,15 +169,14 @@ (define private-keywords
>  
>  (define* (elm-build name inputs
>                      #:key
> -                    source
> +                    modules source
>                      (tests? #t)
>                      (phases '%standard-phases)
>                      (outputs '("out"))
>                      (search-paths '())
>                      (system (%current-system))
>                      (guile #f)
> -                    (imported-modules %elm-build-system-modules)
> -                    (modules %elm-default-modules))
> +                    (imported-modules %elm-build-system-modules))
>    "Build SOURCE using ELM."
>    (define builder
>      (with-imported-modules imported-modules
> @@ -203,4 +202,5 @@ (define elm-build-system
>    (build-system
>      (name 'elm)
>      (description "The Elm build system")
> +    (modules %elm-default-modules)
>      (lower lower)))
> diff --git a/guix/build-system/emacs.scm b/guix/build-system/emacs.scm
> index 61b9c171b44..0056d76b0d5 100644
> --- a/guix/build-system/emacs.scm
> +++ b/guix/build-system/emacs.scm
> @@ -81,7 +81,7 @@ (define private-keywords
>           (arguments (strip-keyword-arguments private-keywords arguments)))))
>  
>  (define* (emacs-build name inputs
> -                      #:key source
> +                      #:key modules source
>                        (tests? (not (%current-target-system)))
>                        (parallel-tests? #t)
>                        (test-command #f) ; inferred in emacs-build-system
> @@ -94,9 +94,6 @@ (define* (emacs-build name inputs
>                        (system (%current-system))
>                        (guile #f)
>                        (imported-modules %emacs-build-system-modules)
> -                      (modules '((guix build emacs-build-system)
> -                                 (guix build utils)
> -                                 (guix build emacs-utils)))
>                        allowed-references
>                        disallowed-references)
>    "Build SOURCE using EMACS, and with INPUTS."
> @@ -132,6 +129,9 @@ (define emacs-build-system
>    (build-system
>      (name 'emacs)
>      (description "The build system for Emacs packages")
> +    (modules '((guix build emacs-build-system)
> +               (guix build utils)
> +               (guix build emacs-utils)))
>      (lower lower)))
>  
>  ;;; emacs.scm ends here
> diff --git a/guix/build-system/font.scm b/guix/build-system/font.scm
> index a4eeca00ca6..61905074c06 100644
> --- a/guix/build-system/font.scm
> +++ b/guix/build-system/font.scm
> @@ -72,7 +72,7 @@ (define private-keywords
>      (arguments (strip-keyword-arguments private-keywords arguments))))
>  
>  (define* (font-build name inputs
> -                     #:key source
> +                     #:key modules source
>                       (tests? #t)
>                       (test-target "test")
>                       (configure-flags ''())
> @@ -82,9 +82,7 @@ (define* (font-build name inputs
>                       (search-paths '())
>                       (system (%current-system))
>                       (guile #f)
> -                     (imported-modules %font-build-system-modules)
> -                     (modules '((guix build font-build-system)
> -                                (guix build utils))))
> +                     (imported-modules %font-build-system-modules))
>    "Build SOURCE with INPUTS."
>    (define builder
>      (with-imported-modules imported-modules
> @@ -120,6 +118,8 @@ (define font-build-system
>    (build-system
>      (name 'font)
>      (description "The build system for font packages")
> +    (modules '((guix build font-build-system)
> +               (guix build utils)))
>      (lower lower)))
>  
>  ;;; font.scm ends here
> diff --git a/guix/build-system/glib-or-gtk.scm 
> b/guix/build-system/glib-or-gtk.scm
> index c912adab4aa..729cea539e9 100644
> --- a/guix/build-system/glib-or-gtk.scm
> +++ b/guix/build-system/glib-or-gtk.scm
> @@ -124,7 +124,7 @@ (define private-keywords
>      (arguments (strip-keyword-arguments private-keywords arguments))))
>  
>  (define* (glib-or-gtk-build name inputs
> -                            #:key guile source
> +                            #:key guile modules source
>                              (outputs '("out"))
>                              (search-paths '())
>                              (configure-flags ''())
> @@ -145,7 +145,6 @@ (define* (glib-or-gtk-build name inputs
>                              (glib-or-gtk-wrap-excluded-outputs ''())
>                              (system (%current-system))
>                              (imported-modules 
> %glib-or-gtk-build-system-modules)
> -                            (modules 
> %glib-or-gtk-build-system-default-modules)
>                              allowed-references
>                              disallowed-references)
>    "Build SOURCE with INPUTS.  See GNU-BUILD for more details."
> @@ -196,7 +195,7 @@ (define* (glib-or-gtk-cross-build name
>                                    #:key
>                                    target
>                                    build-inputs target-inputs host-inputs
> -                                  guile source
> +                                  guile modules source
>                                    (outputs '("out"))
>                                    (search-paths '())
>                                    (native-search-paths '())
> @@ -220,7 +219,6 @@ (define* (glib-or-gtk-cross-build name
>                                    (system (%current-system))
>                                    (build (nix-system->gnu-triplet system))
>                                    (imported-modules 
> %glib-or-gtk-build-system-modules)
> -                                  (modules 
> %glib-or-gtk-build-system-default-modules)
>                                    allowed-references
>                                    disallowed-references)
>    "Cross-build SOURCE with INPUTS.  See GNU-BUILD for more details."
> @@ -292,4 +290,5 @@ (define glib-or-gtk-build-system
>       "The GNU Build System—i.e., ./configure && make && make install,
>  augmented with definition of suitable environment variables for glib and gtk+
>  in program wrappers.")
> +    (modules %glib-or-gtk-build-system-default-modules)
>      (lower lower)))
> diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm
> index 8f0883956e3..c61361150ce 100644
> --- a/guix/build-system/gnu.scm
> +++ b/guix/build-system/gnu.scm
> @@ -344,7 +344,7 @@ (define %strip-directories
>  
>  (define* (gnu-build name inputs
>                      #:key
> -                    guile source
> +                    guile modules source
>                      (outputs '("out"))
>                      (search-paths '())
>                      (bootstrap-scripts %bootstrap-scripts)
> @@ -368,7 +368,6 @@ (define* (gnu-build name inputs
>                      (system (%current-system))
>                      (build (nix-system->gnu-triplet system))
>                      (imported-modules %default-gnu-imported-modules)
> -                    (modules %default-gnu-modules)
>                      (substitutable? #t)
>                      allowed-references
>                      disallowed-references)
> @@ -483,7 +482,7 @@ (define* (gnu-cross-build name
>                            #:key
>                            target
>                            build-inputs target-inputs host-inputs
> -                          guile source
> +                          guile modules source
>                            (outputs '("out"))
>                            (search-paths '())
>                            (native-search-paths '())
> @@ -513,7 +512,6 @@ (define* (gnu-cross-build name
>                            (system (%current-system))
>                            (build (nix-system->gnu-triplet system))
>                            (imported-modules %default-gnu-imported-modules)
> -                          (modules %default-gnu-modules)
>                            (substitutable? #t)
>                            allowed-references
>                            disallowed-references)
> @@ -590,4 +588,5 @@ (define gnu-build-system
>      (name 'gnu)
>      (description
>       "The GNU Build System—i.e., ./configure && make && make install")
> +    (modules %default-gnu-modules)
>      (lower lower)))
> diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm
> index 8e03efa2eb9..1c032cbecc4 100644
> --- a/guix/build-system/go.scm
> +++ b/guix/build-system/go.scm
> @@ -195,7 +195,7 @@ (define inputs-with-cache
>  
>  (define* (go-build name inputs
>                     #:key
> -                   source
> +                   modules source
>                     (phases '%standard-phases)
>                     (outputs '("out"))
>                     (search-paths '())
> @@ -216,9 +216,6 @@ (define* (go-build name inputs
>                     (goos #f)
>                     (guile #f)
>                     (imported-modules %go-build-system-modules)
> -                   (modules '((guix build go-build-system)
> -                              (guix build union)
> -                              (guix build utils)))
>                     (substitutable? #t))
>    (define builder
>      (with-imported-modules imported-modules
> @@ -257,7 +254,7 @@ (define builder
>  
>  (define* (go-cross-build name
>                           #:key
> -                         source target
> +                         modules source target
>                           build-inputs target-inputs host-inputs
>                           (phases '%standard-phases)
>                           (outputs '("out"))
> @@ -280,9 +277,6 @@ (define* (go-cross-build name
>                           (embed-files ''())
>                           (guile #f)
>                           (imported-modules %go-build-system-modules)
> -                         (modules '((guix build go-build-system)
> -                                    (guix build union)
> -                                    (guix build utils)))
>                           (substitutable? #t))
>    "Cross-build NAME using GO, where TARGET is a GNU triplet and with INPUTS."
>    (define builder
> @@ -347,4 +341,7 @@ (define go-build-system
>      (name 'go)
>      (description
>       "Build system for Go programs")
> +    (modules '((guix build go-build-system)
> +               (guix build union)
> +               (guix build utils)))
>      (lower lower)))
> diff --git a/guix/build-system/guile.scm b/guix/build-system/guile.scm
> index df6988a1b7e..467e0e61542 100644
> --- a/guix/build-system/guile.scm
> +++ b/guix/build-system/guile.scm
> @@ -76,7 +76,7 @@ (define %compile-flags
>    ''("-Wunbound-variable" "-Warity-mismatch" "-Wformat"))
>  
>  (define* (guile-build name inputs
> -                      #:key source
> +                      #:key modules source
>                        (guile #f)
>                        (phases '%standard-phases)
>                        (outputs '("out"))
> @@ -91,8 +91,6 @@ (define* (guile-build name inputs
>                        (parallel-build? #f)
>                        (compile-flags %compile-flags)
>                        (imported-modules %guile-build-system-modules)
> -                      (modules '((guix build guile-build-system)
> -                                 (guix build utils)))
>                        (substitutable? #t))
>    "Build SOURCE using Guile taken from the native inputs, and with INPUTS."
>    (define builder
> @@ -128,7 +126,7 @@ (define* (guile-cross-build name
>                              (system (%current-system)) target
>                              build-inputs target-inputs host-inputs
>                              (guile #f)
> -                            source
> +                            modules source
>                              (outputs '("out"))
>                              (search-paths '())
>                              (native-search-paths '())
> @@ -144,8 +142,6 @@ (define* (guile-cross-build name
>                              (parallel-build? #f)
>                              (compile-flags %compile-flags)
>                              (imported-modules %guile-build-system-modules)
> -                            (modules '((guix build guile-build-system)
> -                                       (guix build utils)))
>                              (substitutable? #t))
>    (define builder
>      (with-imported-modules imported-modules
> @@ -194,4 +190,6 @@ (define guile-build-system
>    (build-system
>      (name 'guile)
>      (description "The build system for simple Guile packages")
> +    (modules '((guix build guile-build-system)
> +               (guix build utils)))
>      (lower lower)))
> diff --git a/guix/build-system/haskell.scm b/guix/build-system/haskell.scm
> index b0019dd0144..ef3d51c7d90 100644
> --- a/guix/build-system/haskell.scm
> +++ b/guix/build-system/haskell.scm
> @@ -125,7 +125,7 @@ (define (cabal-revision->origin cabal-revision)
>                         extra-directories))))))))
>  
>  (define* (haskell-build name inputs
> -                        #:key source
> +                        #:key modules source
>                          (haddock? #t)
>                          (haddock-flags ''())
>                          (tests? #t)
> @@ -140,9 +140,7 @@ (define* (haskell-build name inputs
>                          (search-paths '())
>                          (system (%current-system))
>                          (guile #f)
> -                        (imported-modules %haskell-build-system-modules)
> -                        (modules '((guix build haskell-build-system)
> -                                   (guix build utils))))
> +                        (imported-modules %haskell-build-system-modules))
>    "Build SOURCE using HASKELL, and with INPUTS.  This assumes that SOURCE
>  provides a 'Setup.hs' file as its build system."
>    (define builder
> @@ -188,6 +186,8 @@ (define haskell-build-system
>    (build-system
>      (name 'haskell)
>      (description "The standard Haskell build system")
> +    (modules '((guix build haskell-build-system)
> +               (guix build utils)))
>      (lower lower)))
>  
>  ;;; haskell.scm ends here
> diff --git a/guix/build-system/julia.scm b/guix/build-system/julia.scm
> index e0987496838..71df6fe2beb 100644
> --- a/guix/build-system/julia.scm
> +++ b/guix/build-system/julia.scm
> @@ -77,7 +77,7 @@ (define private-keywords
>           (arguments (strip-keyword-arguments private-keywords arguments)))))
>  
>  (define* (julia-build name inputs
> -                      #:key source
> +                      #:key modules source
>                        (tests? #t)
>                        (parallel-tests? #t)
>                        (phases '%standard-phases)
> @@ -88,9 +88,7 @@ (define* (julia-build name inputs
>                        (julia-package-name #f)
>                        (julia-package-uuid #f)
>                        (julia-package-dependencies ''())
> -                      (imported-modules %julia-build-system-modules)
> -                      (modules '((guix build julia-build-system)
> -                                 (guix build utils))))
> +                      (imported-modules %julia-build-system-modules))
>    "Build SOURCE using Julia, and with INPUTS."
>    (define builder
>      (with-imported-modules imported-modules
> @@ -121,6 +119,8 @@ (define julia-build-system
>    (build-system
>     (name 'julia)
>     (description "The build system for Julia packages")
> +   (modules '((guix build julia-build-system)
> +              (guix build utils)))
>     (lower lower)))
>  
>  ;;; julia.scm ends here
> diff --git a/guix/build-system/linux-module.scm 
> b/guix/build-system/linux-module.scm
> index d8ebef60d0c..6ec294f081e 100644
> --- a/guix/build-system/linux-module.scm
> +++ b/guix/build-system/linux-module.scm
> @@ -153,7 +153,7 @@ (define private-keywords
>  
>  (define* (linux-module-build name inputs
>                               #:key
> -                             source target
> +                             modules source target
>                               (search-paths '())
>                               (tests? #t)
>                               (phases '%standard-phases)
> @@ -165,9 +165,7 @@ (define* (linux-module-build name inputs
>                               (guile #f)
>                               (substitutable? #t)
>                               (imported-modules
> -                              %linux-module-build-system-modules)
> -                             (modules '((guix build 
> linux-module-build-system)
> -                                        (guix build utils))))
> +                              %linux-module-build-system-modules))
>    "Build SOURCE using LINUX, and with INPUTS."
>    (define builder
>      (with-imported-modules imported-modules
> @@ -200,7 +198,7 @@ (define builder
>  (define* (linux-module-build-cross
>            name
>            #:key
> -          source target
> +          modules source target
>            build-inputs target-inputs host-inputs
>            (guile #f)
>            (outputs '("out"))
> @@ -214,9 +212,7 @@ (define* (linux-module-build-cross
>            (source-directory ".")
>            (substitutable? #t)
>            (imported-modules
> -           %linux-module-build-system-modules)
> -          (modules '((guix build linux-module-build-system)
> -                     (guix build utils))))
> +           %linux-module-build-system-modules))
>    (define builder
>      (with-imported-modules imported-modules
>        #~(begin
> @@ -261,6 +257,8 @@ (define linux-module-build-system
>    (build-system
>      (name 'linux-module)
>      (description "The Linux module build system")
> +    (modules '((guix build linux-module-build-system)
> +               (guix build utils)))
>      (lower lower)))
>  
>  ;;; linux-module.scm ends here
> diff --git a/guix/build-system/maven.scm b/guix/build-system/maven.scm
> index 03e4e96b892..d6faa1b23d9 100644
> --- a/guix/build-system/maven.scm
> +++ b/guix/build-system/maven.scm
> @@ -143,7 +143,7 @@ (define private-keywords
>  
>  (define* (maven-build name inputs
>                        #:key
> -                      source (guile #f)
> +                      modules source (guile #f)
>                        (outputs '("out"))
>                        (search-paths '())
>                        (out-of-source? #t)
> @@ -157,10 +157,7 @@ (define* (maven-build name inputs
>                        (strip-directories %strip-directories)
>                        (phases '%standard-phases)
>                        (system (%current-system))
> -                      (imported-modules %maven-build-system-modules)
> -                      (modules '((guix build maven-build-system)
> -                                 (guix build maven pom)
> -                                 (guix build utils))))
> +                      (imported-modules %maven-build-system-modules))
>    "Build SOURCE using PATCHELF, and with INPUTS. This assumes that SOURCE
>  provides its own binaries."
>    (define builder
> @@ -195,6 +192,9 @@ (define maven-build-system
>    (build-system
>      (name 'maven)
>      (description "The standard Maven build system")
> +    (modules '((guix build maven-build-system)
> +               (guix build maven pom)
> +               (guix build utils)))
>      (lower lower)))
>  
>  ;;; maven.scm ends here
> diff --git a/guix/build-system/meson.scm b/guix/build-system/meson.scm
> index 5eeeb59e65a..a56737c076c 100644
> --- a/guix/build-system/meson.scm
> +++ b/guix/build-system/meson.scm
> @@ -185,7 +185,7 @@ (define private-keywords
>  
>  (define* (meson-build name inputs
>                        #:key
> -                      guile source
> +                      guile modules source
>                        (outputs '("out"))
>                        (configure-flags ''())
>                        (search-paths '())
> @@ -206,8 +206,6 @@ (define* (meson-build name inputs
>                        (phases '%standard-phases)
>                        (system (%current-system))
>                        (imported-modules %meson-build-system-modules)
> -                      (modules '((guix build meson-build-system)
> -                                 (guix build utils)))
>                        (substitutable? #t)
>                        allowed-references
>                        disallowed-references)
> @@ -269,7 +267,7 @@ (define* (meson-cross-build name
>                              #:key
>                              target
>                              build-inputs host-inputs target-inputs
> -                            guile source
> +                            guile modules source
>                              (outputs '("out"))
>                              (configure-flags ''())
>                              (search-paths '())
> @@ -294,8 +292,6 @@ (define* (meson-cross-build name
>                              (phases '%standard-phases)
>                              (system (%current-system))
>                              (imported-modules %meson-build-system-modules)
> -                            (modules '((guix build meson-build-system)
> -                                       (guix build utils)))
>                              (substitutable? #t)
>                              allowed-references
>                              disallowed-references)
> @@ -385,6 +381,8 @@ (define meson-build-system
>    (build-system
>      (name 'meson)
>      (description "The standard Meson build system")
> +    (modules '((guix build meson-build-system)
> +               (guix build utils)))
>      (lower lower)))
>  
>  ;;; meson.scm ends here
> diff --git a/guix/build-system/minetest.scm b/guix/build-system/minetest.scm
> index 9774c5882a5..2edea4dcbcc 100644
> --- a/guix/build-system/minetest.scm
> +++ b/guix/build-system/minetest.scm
> @@ -98,6 +98,7 @@ (define minetest-mod-build-system
>    (build-system
>      (name 'minetest-mod)
>      (description "The build system for minetest mods")
> +    (modules %default-minetest-modules)
>      (lower lower-mod)))
>  
>  ;;; minetest.scm ends here
> diff --git a/guix/build-system/minify.scm b/guix/build-system/minify.scm
> index 98c6e75980d..49a94ae4cbe 100644
> --- a/guix/build-system/minify.scm
> +++ b/guix/build-system/minify.scm
> @@ -72,16 +72,14 @@ (define private-keywords
>  
>  (define* (minify-build name inputs
>                         #:key
> -                       source
> +                       modules source
>                         (javascript-files #f)
>                         (phases '%standard-phases)
>                         (outputs '("out"))
>                         (system (%current-system))
>                         search-paths
>                         (guile #f)
> -                       (imported-modules %minify-build-system-modules)
> -                       (modules '((guix build minify-build-system)
> -                                  (guix build utils))))
> +                       (imported-modules %minify-build-system-modules))
>    "Build SOURCE with INPUTS."
>    (define builder
>      (with-imported-modules imported-modules
> @@ -107,6 +105,8 @@ (define minify-build-system
>    (build-system
>      (name 'minify)
>      (description "The trivial JavaScript minification build system")
> +    (modules '((guix build minify-build-system)
> +               (guix build utils)))
>      (lower lower)))
>  
>  ;;; minify.scm ends here
> diff --git a/guix/build-system/mix.scm b/guix/build-system/mix.scm
> index 4a3ba9fb604..daecc7b5bcf 100644
> --- a/guix/build-system/mix.scm
> +++ b/guix/build-system/mix.scm
> @@ -74,7 +74,7 @@ (define (hexpm-uri name version)
>  (define* (mix-build name
>                      inputs
>                      #:key
> -                    source
> +                    modules source
>                      (tests? #t)
>                      (mix-path #f) ;See MIX_PATH.
>                      (mix-exs "mix.exs") ;See MIX_EXS.
> @@ -85,9 +85,7 @@ (define* (mix-build name
>                      (system (%current-system))
>                      (guile #f)
>                      (imported-modules `((guix build mix-build-system)
> -                                        ,@%default-gnu-imported-modules))
> -                    (modules '((guix build mix-build-system)
> -                               (guix build utils))))
> +                                        ,@%default-gnu-imported-modules)))
>    "Build SOURCE using Elixir, and with INPUTS."
>  
>    ;; Check the documentation of :build_per_environment here:
> @@ -174,6 +172,8 @@ (define* (lower name
>  (define mix-build-system
>    (build-system (name 'mix)
>                  (description "The standard Mix build system")
> +                (modules '((guix build mix-build-system)
> +                           (guix build utils)))
>                  (lower lower)))
>  
>  ;;; mix.scm ends here
> diff --git a/guix/build-system/mozilla.scm b/guix/build-system/mozilla.scm
> index bead1bf5bbc..8face65bf91 100644
> --- a/guix/build-system/mozilla.scm
> +++ b/guix/build-system/mozilla.scm
> @@ -47,6 +47,7 @@ (define mozilla-build-system
>    (build-system
>      (name 'mozilla)
>      (description "The build system for Mozilla software using the Autotools")
> +    (modules %default-gnu-modules)
>      (lower lower-mozilla)))
>  
>  ;;; mozilla.scm ends here
> diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm
> index cde0ccb60e5..6a6183c7041 100644
> --- a/guix/build-system/node.scm
> +++ b/guix/build-system/node.scm
> @@ -88,7 +88,7 @@ (define (default-guile-json)
>  
>  (define* (node-build name inputs
>                       #:key
> -                     source
> +                     modules source
>                       (npm-flags ''())
>                       (test-target "test")
>                       (tests? #t)
> @@ -98,9 +98,7 @@ (define* (node-build name inputs
>                       (system (%current-system))
>                       (guile #f)
>                       (guile-json (default-guile-json))
> -                     (imported-modules %node-build-system-modules)
> -                     (modules '((guix build node-build-system)
> -                                (guix build utils))))
> +                     (imported-modules %node-build-system-modules))
>    "Build SOURCE using NODE and INPUTS."
>    (define builder
>      (with-extensions (list guile-json)
> @@ -130,4 +128,6 @@ (define node-build-system
>    (build-system
>      (name 'node)
>      (description "The Node build system")
> +    (modules '((guix build node-build-system)
> +               (guix build utils)))
>      (lower lower)))
> diff --git a/guix/build-system/ocaml.scm b/guix/build-system/ocaml.scm
> index 2f2e6dd62e0..3460dbf85d6 100644
> --- a/guix/build-system/ocaml.scm
> +++ b/guix/build-system/ocaml.scm
> @@ -255,7 +255,7 @@ (define private-keywords
>  
>  (define* (ocaml-build name inputs
>                        #:key
> -                      guile source
> +                      guile modules source
>                        (outputs '("out")) (configure-flags ''())
>                        (search-paths '())
>                        (make-flags ''())
> @@ -274,9 +274,7 @@ (define* (ocaml-build name inputs
>                        (phases '(@ (guix build ocaml-build-system)
>                                    %standard-phases))
>                        (system (%current-system))
> -                      (imported-modules %ocaml-build-system-modules)
> -                      (modules '((guix build ocaml-build-system)
> -                                 (guix build utils))))
> +                      (imported-modules %ocaml-build-system-modules))
>    "Build SOURCE using OCAML, and with INPUTS. This assumes that SOURCE
>  provides a 'setup.ml' file as its build system."
>    (define builder
> @@ -315,6 +313,8 @@ (define ocaml-build-system
>    (build-system
>      (name 'ocaml)
>      (description "The standard OCaml build system")
> +    (modules '((guix build ocaml-build-system)
> +               (guix build utils)))
>      (lower lower)))
>  
>  ;;; ocaml.scm ends here
> diff --git a/guix/build-system/perl.scm b/guix/build-system/perl.scm
> index 98d48fec7c0..0de9bef2961 100644
> --- a/guix/build-system/perl.scm
> +++ b/guix/build-system/perl.scm
> @@ -102,7 +102,7 @@ (define private-keywords
>      (arguments (strip-keyword-arguments private-keywords arguments))))
>  
>  (define* (perl-build name inputs
> -                     #:key source
> +                     #:key modules source
>                       (search-paths '())
>                       (tests? #t)
>                       (parallel-build? #t)
> @@ -115,9 +115,7 @@ (define* (perl-build name inputs
>                       (outputs '("out"))
>                       (system (%current-system))
>                       (guile #f)
> -                     (imported-modules %perl-build-system-modules)
> -                     (modules '((guix build perl-build-system)
> -                                (guix build utils))))
> +                     (imported-modules %perl-build-system-modules))
>    "Build SOURCE using PERL, and with INPUTS.  This assumes that SOURCE
>  provides a `Makefile.PL' file as its build system."
>    (define build
> @@ -156,8 +154,7 @@ (define build
>                        #:guile-for-build guile)))
>  
>  (define* (perl-cross-build name #:key
> -                           source
> -                           target
> +                           modules source target
>                             build-inputs host-inputs target-inputs
>                             (search-paths '())
>                             (native-search-paths '())
> @@ -173,9 +170,7 @@ (define* (perl-cross-build name #:key
>                             (system (%current-system))
>                             (build (nix-system->gnu-triplet system))
>                             (guile #f)
> -                           (imported-modules %perl-build-system-modules)
> -                           (modules '((guix build perl-build-system)
> -                                      (guix build utils))))
> +                           (imported-modules %perl-build-system-modules))
>    "Cross-build SOURCE to TARGET using PERL, and with INPUTS.  This assumes
>  that SOURCE provides a `Makefile.PL' file as its build system and does not 
> use
>  XS or similar."
> @@ -223,6 +218,8 @@ (define perl-build-system
>    (build-system
>      (name 'perl)
>      (description "The standard Perl build system")
> +    (modules '((guix build perl-build-system)
> +               (guix build utils)))
>      (lower lower)))
>  
>  ;;; perl.scm ends here
> diff --git a/guix/build-system/pyproject.scm b/guix/build-system/pyproject.scm
> index bdf8f440acc..6519286208d 100644
> --- a/guix/build-system/pyproject.scm
> +++ b/guix/build-system/pyproject.scm
> @@ -91,7 +91,7 @@ (define private-keywords
>           (arguments (strip-keyword-arguments private-keywords arguments)))))
>  
>  (define* (pyproject-build name inputs
> -                          #:key source
> +                          #:key modules source
>                            (tests? #t)
>                            (configure-flags ''(@))
>                            (backend-path #f)
> @@ -104,8 +104,6 @@ (define* (pyproject-build name inputs
>                            (system (%current-system))
>                            (guile #f)
>                            (imported-modules %pyproject-build-system-modules)
> -                          (modules '((guix build pyproject-build-system)
> -                                     (guix build utils)))
>                            allowed-references
>                            disallowed-references)
>    "Build SOURCE using PYTHON, and with INPUTS."
> @@ -149,6 +147,8 @@ (define pyproject-build-system
>    (build-system
>      (name 'pyproject)
>      (description "The PEP517-compliant Python build system")
> +    (modules '((guix build pyproject-build-system)
> +               (guix build utils)))
>      (lower lower)))
>  
>  ;;; pyproject.scm ends here
> diff --git a/guix/build-system/python.scm b/guix/build-system/python.scm
> index a51c033d01e..64c2b7ef527 100644
> --- a/guix/build-system/python.scm
> +++ b/guix/build-system/python.scm
> @@ -167,7 +167,7 @@ (define private-keywords
>           (arguments (strip-keyword-arguments private-keywords arguments)))))
>  
>  (define* (python-build name inputs
> -                       #:key source
> +                       #:key modules source
>                         (tests? #t)
>                         (test-target "test")
>                         (use-setuptools? #t)
> @@ -178,8 +178,6 @@ (define* (python-build name inputs
>                         (system (%current-system))
>                         (guile #f)
>                         (imported-modules %python-build-system-modules)
> -                       (modules '((guix build python-build-system)
> -                                  (guix build utils)))
>                         allowed-references
>                         disallowed-references)
>    "Build SOURCE using PYTHON, and with INPUTS.  This assumes that SOURCE
> @@ -220,6 +218,8 @@ (define python-build-system
>    (build-system
>      (name 'python)
>      (description "The standard Python build system")
> +    (modules '((guix build python-build-system)
> +               (guix build utils)))
>      (lower lower)))
>  
>  ;;; python.scm ends here
> diff --git a/guix/build-system/qt.scm b/guix/build-system/qt.scm
> index d1f721c54e7..87b95c99d6c 100644
> --- a/guix/build-system/qt.scm
> +++ b/guix/build-system/qt.scm
> @@ -123,7 +123,7 @@ (define private-keywords
>  (define* (qt-build name inputs
>                     #:key
>                     (qtbase (default-qtbase))
> -                   source (guile #f)
> +                   modules source (guile #f)
>                     (outputs '("out")) (configure-flags ''())
>                     (search-paths '())
>                     (make-flags ''())
> @@ -142,8 +142,6 @@ (define* (qt-build name inputs
>                     (qt-wrap-excluded-inputs %qt-wrap-excluded-inputs)
>                     (system (%current-system))
>                     (imported-modules %qt-build-system-modules)
> -                   (modules '((guix build qt-build-system)
> -                              (guix build utils)))
>                     allowed-references
>                     disallowed-references)
>    "Build SOURCE using CMAKE, and with INPUTS. This assumes that SOURCE
> @@ -195,7 +193,7 @@ (define builder
>  
>  (define* (qt-cross-build name
>                           #:key
> -                         source target
> +                         modules source target
>                           build-inputs target-inputs host-inputs
>                           (qtbase (default-qtbase))
>                           (guile #f)
> @@ -218,8 +216,6 @@ (define* (qt-cross-build name
>                           (system (%current-system))
>                           (build (nix-system->gnu-triplet system))
>                           (imported-modules %qt-build-system-modules)
> -                         (modules '((guix build qt-build-system)
> -                                    (guix build utils)))
>                           allowed-references
>                           disallowed-references)
>    "Cross-build NAME using CMAKE for TARGET, where TARGET is a GNU triplet and
> @@ -285,4 +281,6 @@ (define qt-build-system
>      (description
>       "The CMake build system augmented with definition of suitable 
> environment
>  variables for Qt and KDE in program wrappers.")
> +    (modules '((guix build qt-build-system)
> +               (guix build utils)))
>      (lower lower)))
> diff --git a/guix/build-system/r.scm b/guix/build-system/r.scm
> index 92449c7dbbc..530c45f8437 100644
> --- a/guix/build-system/r.scm
> +++ b/guix/build-system/r.scm
> @@ -104,7 +104,7 @@ (define private-keywords
>  
>  (define* (r-build name inputs
>                    #:key
> -                  source
> +                  modules source
>                    (tests? #t)
>                    (test-target "tests")
>                    (test-types #f)
> @@ -115,9 +115,7 @@ (define* (r-build name inputs
>                    (system (%current-system))
>                    (guile #f)
>                    (substitutable? #t)
> -                  (imported-modules %r-build-system-modules)
> -                  (modules '((guix build r-build-system)
> -                             (guix build utils))))
> +                  (imported-modules %r-build-system-modules))
>    "Build SOURCE with INPUTS."
>    (define builder
>      (with-imported-modules imported-modules
> @@ -148,6 +146,8 @@ (define r-build-system
>    (build-system
>      (name 'r)
>      (description "The standard R build system")
> +    (modules '((guix build r-build-system)
> +               (guix build utils)))
>      (lower lower)))
>  
>  ;;; r.scm ends here
> diff --git a/guix/build-system/rakudo.scm b/guix/build-system/rakudo.scm
> index ee13c507913..182a0820342 100644
> --- a/guix/build-system/rakudo.scm
> +++ b/guix/build-system/rakudo.scm
> @@ -99,7 +99,7 @@ (define private-keywords
>  
>  (define* (rakudo-build name inputs
>                         #:key
> -                       source
> +                       modules source
>                         (search-paths '())
>                         (tests? #t)
>                         (phases '%standard-phases)
> @@ -108,9 +108,7 @@ (define* (rakudo-build name inputs
>                         (guile #f)
>                         (with-zef? #t)
>                         (with-prove6? #t)
> -                       (imported-modules %rakudo-build-system-modules)
> -                       (modules '((guix build rakudo-build-system)
> -                                  (guix build utils))))
> +                       (imported-modules %rakudo-build-system-modules))
>    "Build SOURCE using PERL6, and with INPUTS."
>    (define builder
>      (with-imported-modules imported-modules
> @@ -137,6 +135,8 @@ (define rakudo-build-system
>    (build-system
>      (name 'rakudo)
>      (description "The standard Rakudo build system")
> +    (modules '((guix build rakudo-build-system)
> +               (guix build utils)))
>      (lower lower)))
>  
>  ;;; rakudo.scm ends here
> diff --git a/guix/build-system/rebar.scm b/guix/build-system/rebar.scm
> index 7c7cc5870f8..bb7bdebfdbe 100644
> --- a/guix/build-system/rebar.scm
> +++ b/guix/build-system/rebar.scm
> @@ -99,7 +99,7 @@ (define private-keywords
>  
>  (define* (rebar-build name inputs
>                         #:key
> -                       guile source
> +                       guile modules source
>                         (rebar-flags ''("skip_deps=true" "-vv"))
>                         (tests? #t)
>                         (test-target "eunit")
> @@ -111,9 +111,7 @@ (define* (rebar-build name inputs
>                         (search-paths '())
>                         (native-search-paths '())
>                         (system (%current-system))
> -                       (imported-modules %rebar-build-system-modules)
> -                       (modules '((guix build rebar-build-system)
> -                                  (guix build utils))))
> +                       (imported-modules %rebar-build-system-modules))
>    "Build SOURCE with INPUTS."
>  
>    (define builder
> @@ -153,4 +151,6 @@ (define rebar-build-system
>    (build-system
>      (name 'rebar)
>      (description "The standard Rebar build system")
> +    (modules '((guix build rebar-build-system)
> +               (guix build utils)))
>      (lower lower)))
> diff --git a/guix/build-system/renpy.scm b/guix/build-system/renpy.scm
> index 015dd7c2104..1eee097dd91 100644
> --- a/guix/build-system/renpy.scm
> +++ b/guix/build-system/renpy.scm
> @@ -74,7 +74,7 @@ (define private-keywords
>  
>  (define* (renpy-build name inputs
>                        #:key
> -                      source
> +                      modules source
>                        (phases '%standard-phases)
>                        (configure-flags ''())
>                        (outputs '("out"))
> @@ -83,9 +83,7 @@ (define* (renpy-build name inputs
>                        (search-paths '())
>                        (system (%current-system))
>                        (guile #f)
> -                      (imported-modules %renpy-build-system-modules)
> -                      (modules '((guix build renpy-build-system)
> -                                 (guix build utils))))
> +                      (imported-modules %renpy-build-system-modules))
>    "Build SOURCE using RENPY, and with INPUTS."
>    (define builder
>      (with-imported-modules imported-modules
> @@ -114,4 +112,6 @@ (define renpy-build-system
>    (build-system
>      (name 'renpy)
>      (description "The Ren'py build system")
> +    (modules '((guix build renpy-build-system)
> +               (guix build utils)))
>      (lower lower)))
> diff --git a/guix/build-system/ruby.scm b/guix/build-system/ruby.scm
> index f258ade6e75..f6f759bd6f8 100644
> --- a/guix/build-system/ruby.scm
> +++ b/guix/build-system/ruby.scm
> @@ -75,7 +75,7 @@ (define private-keywords
>           (arguments (strip-keyword-arguments private-keywords arguments)))))
>  
>  (define* (ruby-build name inputs
> -                     #:key source
> +                     #:key modules source
>                       (gem-flags ''())
>                       (test-target "test")
>                       (tests? #t)
> @@ -84,9 +84,7 @@ (define* (ruby-build name inputs
>                       (search-paths '())
>                       (system (%current-system))
>                       (guile #f)
> -                     (imported-modules %ruby-build-system-modules)
> -                     (modules '((guix build ruby-build-system)
> -                                (guix build utils))))
> +                     (imported-modules %ruby-build-system-modules))
>    "Build SOURCE using RUBY and INPUTS."
>    (define build
>      (with-imported-modules imported-modules
> @@ -121,4 +119,6 @@ (define ruby-build-system
>    (build-system
>      (name 'ruby)
>      (description "The standard Ruby build system")
> +    (modules '((guix build ruby-build-system)
> +               (guix build utils)))
>      (lower lower)))
> diff --git a/guix/build-system/scons.scm b/guix/build-system/scons.scm
> index e76c419b1e4..d9086fb5ff7 100644
> --- a/guix/build-system/scons.scm
> +++ b/guix/build-system/scons.scm
> @@ -75,6 +75,7 @@ (define private-keywords
>  
>  (define* (scons-build name inputs
>                        #:key
> +                      modules
>                        (source #f)
>                        (tests? #t)
>                        (scons-flags ''())
> @@ -86,9 +87,7 @@ (define* (scons-build name inputs
>                        (search-paths '())
>                        (system (%current-system))
>                        (guile #f)
> -                      (imported-modules %scons-build-system-modules)
> -                      (modules '((guix build scons-build-system)
> -                                 (guix build utils))))
> +                      (imported-modules %scons-build-system-modules))
>    "Build SOURCE using SCons, and with INPUTS.  This assumes that SOURCE
>  provides a 'SConstruct' file as its build system."
>    (define builder
> @@ -127,6 +126,8 @@ (define scons-build-system
>    (build-system
>      (name 'scons)
>      (description "The standard SCons build system")
> +    (modules '((guix build scons-build-system)
> +               (guix build utils)))
>      (lower lower)))
>  
>  ;;; scons.scm ends here
> diff --git a/guix/build-system/texlive.scm b/guix/build-system/texlive.scm
> index 35587b50fc0..b7a1626dd1a 100644
> --- a/guix/build-system/texlive.scm
> +++ b/guix/build-system/texlive.scm
> @@ -99,7 +99,7 @@ (define private-keywords
>  
>  (define* (texlive-build name inputs
>                          #:key
> -                        source
> +                        modules source
>                          (tests? #f)
>                          (build-targets #f)
>                          (create-formats #f)
> @@ -120,10 +120,7 @@ (define* (texlive-build name inputs
>                          (system (%current-system))
>                          (guile #f)
>                          (substitutable? #t)
> -                        (imported-modules %texlive-build-system-modules)
> -                        (modules '((guix build texlive-build-system)
> -                                   (guix build union)
> -                                   (guix build utils))))
> +                        (imported-modules %texlive-build-system-modules))
>    "Build SOURCE with INPUTS."
>    (define builder
>      (with-imported-modules imported-modules
> @@ -164,6 +161,9 @@ (define texlive-build-system
>    (build-system
>      (name 'texlive)
>      (description "The build system for TeX Live packages")
> +    (modules '((guix build texlive-build-system)
> +                                   (guix build union)
> +                                   (guix build utils)))
>      (lower lower)))
>  
>  ;;; texlive.scm ends here
> diff --git a/guix/build-system/tree-sitter.scm 
> b/guix/build-system/tree-sitter.scm
> index 90d9704cb84..008825dd68a 100644
> --- a/guix/build-system/tree-sitter.scm
> +++ b/guix/build-system/tree-sitter.scm
> @@ -97,7 +97,7 @@ (define grammar-inputs
>  
>  (define* (tree-sitter-build name inputs
>                              #:key
> -                            source
> +                            modules source
>                              (phases '%standard-phases)
>                              (grammar-directories '("."))
>                              (tests? #t)
> @@ -106,9 +106,7 @@ (define* (tree-sitter-build name inputs
>                              (system (%current-system))
>                              (guile #f)
>                              (guile-json (default-guile-json))
> -                            (imported-modules 
> %tree-sitter-build-system-modules)
> -                            (modules '((guix build utils)
> -                                       (guix build 
> tree-sitter-build-system))))
> +                            (imported-modules 
> %tree-sitter-build-system-modules))
>    (define builder
>      (with-extensions (list guile-json)
>        (with-imported-modules imported-modules
> @@ -137,7 +135,7 @@ (define* (tree-sitter-cross-build name
>                                    #:key
>                                    target
>                                    build-inputs target-inputs host-inputs
> -                                  guile source
> +                                  guile modules source
>                                    (phases '%standard-phases)
>                                    (grammar-directories '("."))
>                                    (tests? #t)
> @@ -148,10 +146,7 @@ (define* (tree-sitter-cross-build name
>                                    (guile-json (default-guile-json))
>                                    (build (nix-system->gnu-triplet system))
>                                    (imported-modules
> -                                   %tree-sitter-build-system-modules)
> -                                  (modules
> -                                   '((guix build utils)
> -                                     (guix build tree-sitter-build-system))))
> +                                   %tree-sitter-build-system-modules))
>    (define builder
>      (with-extensions (list guile-json)
>        (with-imported-modules imported-modules
> @@ -200,6 +195,8 @@ (define tree-sitter-build-system
>    (build-system
>      (name 'tree-sitter)
>      (description "The Tree-sitter grammar build system")
> +    (modules '((guix build utils)
> +               (guix build tree-sitter-build-system)))
>      (lower lower)))
>  
>  ;;; tree-sitter.scm ends here
> diff --git a/guix/build-system/trivial.scm b/guix/build-system/trivial.scm
> index e08884baf1f..99107ca428a 100644
> --- a/guix/build-system/trivial.scm
> +++ b/guix/build-system/trivial.scm
> @@ -47,7 +47,7 @@ (define* (lower name
>  (define* (trivial-build name inputs
>                          #:key
>                          outputs guile
> -                        system builder (modules '())
> +                        system builder modules
>                          search-paths allowed-references)
>    "Run build expression BUILDER, an expression, for SYSTEM.  SOURCE is
>  ignored."
> @@ -68,7 +68,7 @@ (define* (trivial-cross-build name
>                                #:key
>                                target
>                                source build-inputs target-inputs host-inputs
> -                              outputs guile system builder (modules '())
> +                              outputs guile system builder modules
>                                search-paths native-search-paths
>                                allowed-references)
>    "Run build expression BUILDER, an expression, for SYSTEM.  SOURCE is
> @@ -94,4 +94,5 @@ (define trivial-build-system
>      (name 'trivial)
>      (description
>       "Trivial build system, to run arbitrary Scheme build expressions")
> +    (modules '())
>      (lower lower)))
> diff --git a/guix/build-system/vim.scm b/guix/build-system/vim.scm
> index dddf7ea14b2..d3e867faf21 100644
> --- a/guix/build-system/vim.scm
> +++ b/guix/build-system/vim.scm
> @@ -98,7 +98,7 @@ (define* (lower name
>  
>  (define* (vim-build name inputs
>                      #:key guile
> -                    source
> +                    modules source
>                      (vim? #f)
>                      (neovim? #f)
>                      (mode "start")
> @@ -116,9 +116,7 @@ (define* (vim-build name inputs
>                      (search-paths '())
>                      (system (%current-system))
>                      (substitutable? #t)
> -                    (imported-modules %vim-build-system-modules)
> -                    (modules '((guix build vim-build-system)
> -                               (guix build utils))))
> +                    (imported-modules %vim-build-system-modules))
>  
>    (define build
>      (with-imported-modules imported-modules
> @@ -165,6 +163,8 @@ (define build
>  (define vim-build-system
>    (build-system (name 'vim)
>                  (description "The standard Vim build system")
> +                (modules '((guix build vim-build-system)
> +                           (guix build utils)))
>                  (lower lower)))
>  
>  ;;; vim.scm ends here
> diff --git a/guix/build-system/waf.scm b/guix/build-system/waf.scm
> index 4ca293ffd89..e9f0d86c162 100644
> --- a/guix/build-system/waf.scm
> +++ b/guix/build-system/waf.scm
> @@ -72,7 +72,7 @@ (define private-keywords
>           (arguments (strip-keyword-arguments private-keywords arguments)))))
>  
>  (define* (waf-build name inputs
> -                    #:key source
> +                    #:key modules source
>                      (tests? #t)
>                      (test-target "check")
>                      (configure-flags #~'())
> @@ -81,9 +81,7 @@ (define* (waf-build name inputs
>                      (search-paths '())
>                      (system (%current-system))
>                      (guile #f)
> -                    (imported-modules %waf-build-system-modules)
> -                    (modules '((guix build waf-build-system)
> -                               (guix build utils))))
> +                    (imported-modules %waf-build-system-modules))
>    "Build SOURCE with INPUTS.  This assumes that SOURCE provides a 'waf' file
>  as its build system."
>    (define build
> @@ -118,6 +116,8 @@ (define waf-build-system
>    (build-system
>      (name 'waf)
>      (description "The standard waf build system")
> +    (modules '((guix build waf-build-system)
> +               (guix build utils)))
>      (lower lower)))
>  
>  ;;; waf.scm ends here
> diff --git a/guix/build-system/zig.scm b/guix/build-system/zig.scm
> index 43d6ee977c3..645184963de 100644
> --- a/guix/build-system/zig.scm
> +++ b/guix/build-system/zig.scm
> @@ -45,7 +45,7 @@ (define %zig-build-system-modules
>  
>  (define* (zig-build name inputs
>                      #:key
> -                    source
> +                    modules source
>                      (tests? #t)
>                      (test-target #f)
>                      (parallel-build? #t)
> @@ -60,9 +60,7 @@ (define* (zig-build name inputs
>                      (search-paths '())
>                      (system (%current-system))
>                      (guile #f)
> -                    (imported-modules %zig-build-system-modules)
> -                    (modules '((guix build zig-build-system)
> -                               (guix build utils))))
> +                    (imported-modules %zig-build-system-modules))
>    "Build SOURCE using Zig, and with INPUTS."
>    (define builder
>      (with-imported-modules imported-modules
> @@ -98,7 +96,7 @@ (define builder
>  
>  (define* (zig-cross-build name
>                            #:key
> -                          source target
> +                          modules source target
>                            build-inputs target-inputs host-inputs
>                            (phases '%standard-phases)
>                            (outputs '("out"))
> @@ -117,9 +115,7 @@ (define* (zig-cross-build name
>                            (zig-release-type #f)
>                            (system (%current-system))
>                            (guile #f)
> -                          (imported-modules %zig-build-system-modules)
> -                          (modules '((guix build zig-build-system)
> -                                     (guix build utils))))
> +                          (imported-modules %zig-build-system-modules))
>    "Build SOURCE using Zig, and with INPUTS."
>    (define builder
>      (with-imported-modules imported-modules
> @@ -218,4 +214,6 @@ (define zig-build-system
>      (name 'zig)
>      (description
>       "Zig build system, to build Zig packages")
> +    (modules '((guix build zig-build-system)
> +               (guix build utils)))
>      (lower lower)))
> -- 
> 2.49.0
>
>
>
>
> On 2025-04-25 15:01, Nicolas Graves wrote:
>
>> On 2025-04-25 10:57, Ludovic Courtès wrote:
>>
>>> Hello,
>>>
>>> Nicolas Graves <ngra...@ngraves.fr> writes:
>>>
>>>> Actually the thunk was not necessary because args were already passed to
>>>> the build-bag procedure, and modules and imported-modules were already
>>>> used in every bag-build procedures, except for trivial and raw
>>>> build-systems.
>>>>
>>>> Patch should look like the one attached, overall pretty simple.
>>
>> I'll probably additionally drop defaults in bag-build procedures, to
>> make it clear that the defaults are coming from <build-system>-modules
>> rather than resulting from default function argument.
>>
>>>> However it does break the build-system API so channels that define a
>>>> build-system will have to update too.
>>>
>>> Maybe we the field could default to the empty list?
>>
>> Yes, I was unsure what to do there.
>>
>> The issue is that for dependent channels, it's probably better to have a
>> clear failure (e.g. "missing required #:imported-modules") rather than
>> having '() silently passed in modules and imported-modules.
>>
>> There are only raw, trivial and channel that use '(), so IMO not a clear
>> requirement. I guess it depends on which error is clearer for dependent
>> channels.  IMHO, it might be better to keep no defaults, as to not
>> silently override current dependent channels modules/imported-modules,
>> and making them fail with a clear error message instead.
>>
>> I could use #:allow-other-keys instead of adding unused
>> (imported-)modules keys to functions, if it makes it clearer.
>>
>> WDYT ?
>>
>>>
>>>> I'll investigate now if we can simply do away without imported-modules
>>>> at all.
>>>
>>> Yes, we should definitely do that.
>>
>> Actually I think the 68315 would be a requirement to do that properly
>> (brainstorming here).
>>
>> Let's say we want some arbitrary way to extend imported modules on the
>> build-system level (i.e. not the package level).  We already explored
>> two solutions :
>> - lower procedure properties
>> - build-system field
>>
>> If we remove build-system field, I don't know how I can do the generic
>> build-system transformation in my use-case.
>>
>> But with 68315 the returned value from the bag-build is a monadic gexp 
>> (rather
>> than a monadic derivation), I probably can do something like: 
>>
>> (define (make-new-lower old-lower other-args)
>>   (lambda* args
>>     (let ((old-bag (apply old-lower args)))
>>       (bag
>>         (inherit old-bag)
>>         (build
>>          (lambda* (name inputs #:key (outputs '("out"))
>>                         #:allow-other-keys #:rest rest)
>>            (mlet %store-monad
>>                ((builder (apply (bag-build old-bag)
>>                                 name inputs #:outputs outputs rest)))
>>              (return
>>               (with-imported-modules additional-imported-modules
>>                 #~(begin
>>                   (use-modules ,@additional-modules)
>>                   (more-code)
>>                   (any-wrapper 
>>                     #$builder))))))))))
>>
>> which is my use-case (and the reason why I needed those in the first
>> place).
>>
>> I don't know how to do that kind of thing if we only drop the
>> default-imported-modules field without 68315.  Am I missing something
>> here?
>>
>> (The reason I need that is that I want guix local instantiate (see next
>> answer) to support a --git option and not drop the .git directory, but
>> still apply guix package-source patches/snippet.  IIUC, I some
>> additional code thus some additional imported-modules to support that.)
>>
>>>> +  (default-modules          build-system-default-modules)
>>>
>>> … and probably change this one to just ‘modules’.
>>
>> OK.
>>
>>>> 1) some patches are improvements independent of wherever I try to do with
>>>> partial builds.  They can already be reviewed now independently from the 
>>>> rest.
>>>
>>> “Partial build”, interesting.  :-)
>>
>> I actually have something working pretty well for trivial packages
>> without patches nor snippets.  Workflow is, in any arbitrary directory:
>>
>> $ guix local instantiate hello
>> $ cd hello* (I have to figure the proper chdir after gnu:unpack, and do
>> that in the previous call guix local instantiate).
>> $ guix local build hello
>>
>> That would build hello locally (in said dir, and install each output in
>> ./$output dir, with all guix-rich info: arguments, store-injected
>> shebangs etc), and keep compilation caches.  There an additional caveat:
>> I drop the 'install-license-files phase, because it is likely dependent
>> on having the output in the store for some reason.
>>
>>>> 2) some patches are standardizing improvements for the names :
>>>>   - %XXX-build-system-modules --> %default-XXX-imported-modules
>>>>   - %XXX-modules or %default-modules --> %default-XXX-modules
>>>>   - is that a fine standardizing change or should I go through a GCD?
>>>
>>> Well, there was already a name change in this area that left me
>>> unconvinced and that we’re still adjusting to, many months later.  So my
>>> advice would be to think twice before renaming bindings with a lot of
>>> users.  A GCD might sound overkill but OTOH it could help think through
>>> the implications.
>>
>> I'm not really that much into it either, just thought some
>> standardization is welcome based on the current state of build-systems.
>> I'll see if it's easy to separate patches where I create the
>> %default-XXX-modules (rarely used but still cleaner in the file) to be
>> applicable before the %default-XXX-imported-modules ones, which would
>> probably require a GCD, and are not a requirement in my use-case.
>>
>>>> 3) some patches are about the core of 68315 (allowing monadic bag-build).
>>
>> Read "monadic gexp" here.

-- 
Best regards,
Nicolas Graves

Reply via email to