guix_mirror_bot pushed a commit to branch master
in repository guix.

commit c36698e8bbc891f13f72fc6d69dfa063a835f567
Author: Giacomo Leidi <[email protected]>
AuthorDate: Sat Jun 28 21:06:45 2025 +0200

    gnu: Add guile-dotenv-cli.
    
    * gnu/packages/guile-xyz.scm (guile-dotenv-cli): New variable.
    
    Change-Id: Ibb6a0f279db918205de8177196af1d5367db0773
    Signed-off-by: Steve George <[email protected]>
---
 gnu/packages/guile-xyz.scm | 76 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)

diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
index 0777336400..323e175418 100644
--- a/gnu/packages/guile-xyz.scm
+++ b/gnu/packages/guile-xyz.scm
@@ -910,6 +910,82 @@ variables from them.")
    (home-page "https://codeberg.org/fishinthecalculator/dotenv";)
    (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
   (package
     (name "guile-dsv")

Reply via email to