Hello! The ‘wip-gexp-imported-modules’ branch changes gexps so that each gexp embeds information about which modules need to be imported into its execution environment.
Before you would do: (gexp->derivation "foo" #~(begin (use-modules (guix build utils)) …) #:modules '((guix build utils))) to specify that (guix build utils) must be imported in the build environment of “foo”. After, it becomes: (gexp->derivation "foo" (with-imported-modules '((guix build utils)) #~(begin (use-modules (guix build utils)) …))) The gain (not visible here) is that when you nest gexps, the outermost gexp now contains all the info about modules that need to be imported. That way, no side channel is needed to carry the imported module info (by “side channel”, I mean things like the ‘imported-modules’ field currently found in <shepherd-service> and several other places.) Thus, it should be easier to compose gexps. I plan to merge it within a day or two. Comments welcome! Ludo’.