gnu: Add guile-dotenv-cli.

* gnu/packages/guile-xyz.scm (guile-dotenv-cli): New variable.

Change-Id: Ibb6a0f279db918205de8177196af1d5367db0773
Signed-off-by: Steve George <steve@futurile.net>
This commit is contained in:
Giacomo Leidi 2025-06-28 21:06:45 +02:00 committed by Steve George
parent 734a1d311d
commit c36698e8bb
No known key found for this signature in database
GPG key ID: F51D4A16DCEE6FA7

View file

@ -910,6 +910,82 @@ variables from them.")
(home-page "https://codeberg.org/fishinthecalculator/dotenv") (home-page "https://codeberg.org/fishinthecalculator/dotenv")
(license license:gpl3+))) (license license:gpl3+)))
(define-public guile-dotenv-cli
(package
(inherit guile-dotenv)
(name "guile-dotenv-cli")
(arguments
(list
#:modules `((ice-9 match)
(ice-9 ftw)
,@%default-gnu-imported-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"))))))))))
(inputs
(modify-inputs (package-inputs guile-dotenv)
(append bash-minimal)))
(native-inputs
(modify-inputs (package-native-inputs guile-dotenv)
;; As opposed to guile-config, here we need to propagate it.
(delete "guile-config")))
(propagated-inputs
(modify-inputs (package-propagated-inputs guile-dotenv)
(prepend guile-config
guile-dotenv)))
(description
(string-append (package-description guile-dotenv)
"\n\nAdditionally, this package provides a @command{dotenv}
command, exposes part of the @code{guile-dotenv} Guile API as command lines
invocations."))))
(define-public guile-dsv (define-public guile-dsv
(package (package
(name "guile-dsv") (name "guile-dsv")