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]<wrap-binaries>: Simplify and add nyacc to the dependencies.

Merges: #1714
Change-Id: I93f441e2aee484bad3926633f710472d343ced7a
This commit is contained in:
Giacomo Leidi 2025-07-31 00:53:24 +02:00 committed by Giacomo Leidi
parent 0908abf25c
commit 8e11f42c0c
No known key found for this signature in database
GPG key ID: 4A3D07EFD05C4045

View file

@ -957,10 +957,13 @@ 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
(with-imported-modules `((guix build guile-build-system)
,@%default-gnu-imported-modules)
#~(modify-phases %standard-phases
(replace 'install
(lambda _
@ -968,48 +971,26 @@ variables from them.")
(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)))
(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 modules path)
(lambda (env path)
(list env ":" 'prefix
(cons modules
(cons (string-append #$output path)
(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"))))))))))
(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)))