From 672556e2d9ff776d293f8fcdb250d0522f42f356 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Mon, 28 Feb 2022 14:27:53 +0530 Subject: forge: Do not use use-modules in with-packages. This composes better. * forge/utils.scm (with-packages): Do not use use-modules. --- forge/utils.scm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'forge') diff --git a/forge/utils.scm b/forge/utils.scm index f0740f0..dd980ef 100644 --- a/forge/utils.scm +++ b/forge/utils.scm @@ -53,13 +53,18 @@ value." PACKAGES are available and their search path environment variables have been set." #~(begin - (use-modules (ice-9 match)) ;; Add a reference to the profile. #$(profile-with-packages packages) ;; Set the environment. - (for-each (match-lambda - ((variable . value) - (setenv variable value))) - '#$(environment-with-packages packages)) + ;; We pull out match-lambda using module-ref instead of using + ;; use-modules because this gexp will be substituted into other + ;; gexps and use-modules only works at the top-level. + (let-syntax ((match-lambda (macro-transformer + (module-ref (resolve-module '(ice-9 match)) + 'match-lambda)))) + (for-each (match-lambda + ((variable . value) + (setenv variable value))) + '#$(environment-with-packages packages))) ;; Run the provided expression. #$exp)) -- cgit v1.2.3