From 8e11f42c0c73c77f17e430ae937f58cbbfbbaf30 Mon Sep 17 00:00:00 2001 From: Giacomo Leidi Date: Thu, 31 Jul 2025 00:53:24 +0200 Subject: [PATCH] gnu: Allow guile-dotenv-cli to find its dependencies. * gnu/packages/guile-xyz.scm (guile-dotenv-cli)[modules]: Add guile-build-system's modules. [phases]: Simplify and add nyacc to the dependencies. Merges: #1714 Change-Id: I93f441e2aee484bad3926633f710472d343ced7a --- gnu/packages/guile-xyz.scm | 85 +++++++++++++++----------------------- 1 file changed, 33 insertions(+), 52 deletions(-) diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm index a93d24488b6..faed873bdec 100644 --- a/gnu/packages/guile-xyz.scm +++ b/gnu/packages/guile-xyz.scm @@ -957,59 +957,40 @@ variables from them.") (name "guile-dotenv-cli") (arguments (list - #:modules `((ice-9 match) - (ice-9 ftw) - ,@%default-gnu-imported-modules) + #:modules `(((guix build guile-build-system) + #:select + (target-guile-effective-version)) + ,@%default-gnu-modules) #:phases - #~(modify-phases %standard-phases - (replace 'install - (lambda _ - (mkdir-p (string-append #$output "/bin")) - (install-file "./scripts/dotenv" - (string-append #$output "/bin/")))) - (add-after 'install 'wrap-binaries - (lambda _ - (let* ((inputs - (list - #$@(map (lambda (input) - (this-package-input input)) - '("guile-config" - "guile-dotenv")))) - (compiled-dir - (lambda (out version) - (string-append out "/lib/guile/" - version "/site-ccache"))) - (uncompiled-dir - (lambda (out version) - (string-append out "/share/guile/site" - (if (string-null? version) "" "/") - version))) - (dep-path - (lambda (env modules path) - (list env ":" 'prefix - (cons modules - (map (lambda (input) - (string-append input path)) - inputs))))) - (bin (string-append #$output "/bin/")) - (site - (uncompiled-dir #$(this-package-input "guile-dotenv") ""))) - (match (scandir site) - (("." ".." version) - (for-each - (lambda (file) - (wrap-program (string-append bin file) - (dep-path - "GUILE_LOAD_PATH" - (uncompiled-dir - #$(this-package-input "guile-dotenv") version) - (uncompiled-dir "" version)) - (dep-path - "GUILE_LOAD_COMPILED_PATH" - (compiled-dir - #$(this-package-input "guile-dotenv") version) - (compiled-dir "" version)))) - '("dotenv")))))))))) + (with-imported-modules `((guix build guile-build-system) + ,@%default-gnu-imported-modules) + #~(modify-phases %standard-phases + (replace 'install + (lambda _ + (mkdir-p (string-append #$output "/bin")) + (install-file "./scripts/dotenv" + (string-append #$output "/bin/")))) + (add-after 'install 'wrap-binaries + (lambda* (#:key inputs #:allow-other-keys) + (let* ((version (target-guile-effective-version)) + (site-ccache (string-append "/lib/guile/" + version "/site-ccache")) + (site (string-append "/share/guile/site/" version)) + (dep-path + (lambda (env path) + (list env ":" 'prefix + (cons (string-append #$output path) + (map (lambda (input) + (string-append + (assoc-ref inputs input) + path)) + (list "guile-config" + "guile-dotenv" + "nyacc")))))) + (bin (string-append (ungexp output) "/bin/"))) + (wrap-program (string-append bin "dotenv") + (dep-path "GUILE_LOAD_PATH" site) + (dep-path "GUILE_LOAD_COMPILED_PATH" site-ccache))))))))) (inputs (modify-inputs (package-inputs guile-dotenv) (append bash-minimal)))