guix_mirror_bot pushed a commit to branch master
in repository guix.
commit a5428016964cdce3fd3d349711a910d8f818485d
Author: Efraim Flashner <[email protected]>
AuthorDate: Mon Feb 23 10:23:16 2026 +0200
gnu: forgejo-cli: Install shell completions.
* gnu/packages/rust-apps.scm (forgejo-cli)[arguments]: Add a phase to
generate the shell completions.
[native-inputs]: When cross-compiling add forgejo-cli.
Change-Id: I6a22ef1b34c833d89244554d8e13b8287b2318ea
---
gnu/packages/rust-apps.scm | 35 +++++++++++++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm
index a32a378ac2..a6ee0d03b5 100644
--- a/gnu/packages/rust-apps.scm
+++ b/gnu/packages/rust-apps.scm
@@ -1266,8 +1266,39 @@ defaults for 80% of the use cases.")
(base32 "1xsqcq6fyhvc4q3f79745lmx1afan5a58d2w920j7hmnczpgz6hh"))))
(build-system cargo-build-system)
(arguments
- (list #:install-source? #f))
- (native-inputs (list pkg-config))
+ (list
+ #:install-source? #f
+ #:modules
+ '((guix build cargo-build-system)
+ (guix build utils)
+ (ice-9 match))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'install 'install-completions
+ (lambda* (#:key native-inputs #:allow-other-keys)
+ (setenv "HOME" (getcwd))
+ (for-each
+ (match-lambda
+ ((shell . path)
+ (mkdir-p (in-vicinity #$output (dirname path)))
+ (let ((binary
+ (if #$(%current-target-system)
+ (search-input-file native-inputs "bin/fj")
+ (in-vicinity #$output "bin/fj"))))
+ (with-output-to-file (in-vicinity #$output path)
+ (lambda _
+ (invoke binary "completion" shell))))))
+ '(("bash" . "share/bash-completion/completions/fj")
+ ("elvish" . "share/elvish/lib/fj")
+ ("fish" . "share/fish/vendor_completions.d/fj.fish")
+ ("nushell" . "share/nushell/vendor/autoload/fj")
+ ("zsh" . "share/zsh/site-functions/_fj"))))))))
+ (native-inputs
+ (append
+ (if (%current-target-system)
+ (list this-package)
+ '())
+ (list pkg-config)))
(inputs
(cons* libgit2-1.9
libssh2