gnu: hyperfine: Simplify installing shell completions.

* gnu/packages/rust-apps.scm (hyperfine)[arguments]: Rewrite installing
the shell completions to use the copy-build-system's install phase.

Change-Id: I3113b1817a2a8ebeb63aa187f736def8babbb5c1
This commit is contained in:
Efraim Flashner
2026-04-23 15:44:39 +03:00
parent fd18daaa4d
commit cfa3de9ba4

View File

@@ -1707,29 +1707,31 @@ characters, ASCII whitespace characters, other ASCII characters and non-ASCII.")
"0b0jhpqg7hamf8zkzw8cwim9550hj3w7cq43702d4yyxdxz6kzn5"))))
(build-system cargo-build-system)
(arguments
`(#:modules ((guix build cargo-build-system)
(guix build utils)
(srfi srfi-26))
#:install-source? #f
#:phases
(modify-phases %standard-phases
(add-after 'install 'install-more
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(share (string-append out "/share/"))
(man (string-append share "man/man1"))
(bash (string-append out "/etc/bash_completion.d/"))
(fish (string-append share "fish/vendor_completions.d"))
(zsh (string-append share "zsh/site-functions")))
(install-file "doc/hyperfine.1" man)
(for-each (cut install-file <> bash)
(find-files "target" "^hyperfine.bash$"))
(rename-file (string-append bash "/hyperfine.bash")
(string-append bash "/hyperfine"))
(for-each (cut install-file <> fish)
(find-files "target" "^hyperfine.fish$"))
(for-each (cut install-file <> zsh)
(find-files "target" "^_hyperfine$"))))))))
(list
#:install-source? #f
#:imported-modules (append %copy-build-system-modules
%cargo-build-system-modules)
#:modules '((guix build cargo-build-system)
((guix build copy-build-system) #:prefix copy:)
(guix build utils))
#:phases
#~(modify-phases %standard-phases
(add-before 'build 'pre-build
(lambda _
(setenv "SHELL_COMPLETIONS_DIR" (string-append (getcwd) "/target"))))
(add-after 'install 'install-extras
(lambda args
(apply (assoc-ref copy:%standard-phases 'install)
#:install-plan
'(("target/hyperfine.bash"
"share/bash-completion/completions/hyperfine")
("target/hyperfine.elv"
"share/elvish/lib/hyperfine")
("target/hyperfine.fish"
"share/fish/vendor_completions.d/")
("target/_hyperfine"
"share/zsh/site-functions/"))
args))))))
(inputs (cargo-inputs 'hyperfine))
(home-page "https://github.com/sharkdp/hyperfine")
(synopsis "Command-line benchmarking tool")