summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiacomo Leidi <goodoldpaul@autistici.org>2025-06-28 21:06:45 +0200
committerSteve George <steve@futurile.net>2025-07-16 13:05:44 +0100
commitc36698e8bbc891f13f72fc6d69dfa063a835f567 (patch)
treebffab1c3901cfa4afdafb15f320ec2e9f9ad6f21
parent734a1d311df45acab73a629ab0943f6615759496 (diff)
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>
-rw-r--r--gnu/packages/guile-xyz.scm76
1 files changed, 76 insertions, 0 deletions
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")