mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
gnu: bcachefs-tools: Add shell completions.
* gnu/packages/file-systems.scm (bcachefs-tools): Rename this… (bcachefs-tools-minimal): …to this. [name]: Rename accordingly. (bcachefs-tools): New public variable, inheriting bcachefs-tools-minimal. (bcachefs-tools/static): Inherit the -minimal variant instead. Change-Id: I203fd4bd642d68435edde355c3a2ff4d44fd5743
This commit is contained in:
parent
49cd866090
commit
09245f698f
1 changed files with 54 additions and 7 deletions
|
@ -622,9 +622,13 @@ (define bcachefs-tools-make-install-flags
|
|||
"PKGCONFIG_UDEVRULESDIR=$(PREFIX)/lib/udev/rules.d"
|
||||
#$bcachefs-tools-make-flags))
|
||||
|
||||
(define-public bcachefs-tools
|
||||
(define bcachefs-tools-minimal
|
||||
;; This ‘minimal’ package is not *that* minimal, and not different enough to
|
||||
;; export. It's used as-is only when cross-compiling, as an input to the
|
||||
;; public bcachefs-tools package that inherits from it to generate the shell
|
||||
;; completions by running a native bcachefs binary at build time.
|
||||
(package
|
||||
(name "bcachefs-tools")
|
||||
(name "bcachefs-tools-minimal")
|
||||
(version "1.11.0")
|
||||
(source
|
||||
(origin
|
||||
|
@ -718,12 +722,55 @@ (define-public bcachefs-tools
|
|||
performance and other characteristics.")
|
||||
(license license:gpl2+)))
|
||||
|
||||
(define-public bcachefs-tools
|
||||
;; The final public package with shell completion even when cross-compiling.
|
||||
(package
|
||||
(inherit bcachefs-tools-minimal)
|
||||
(name "bcachefs-tools")
|
||||
(arguments
|
||||
(substitute-keyword-arguments
|
||||
(package-arguments bcachefs-tools-minimal)
|
||||
((#:modules modules '())
|
||||
`(,@modules
|
||||
(guix build cargo-build-system)
|
||||
(guix build utils)
|
||||
(srfi srfi-26)))
|
||||
((#:phases phases #~%standard-phases)
|
||||
#~(modify-phases #$phases
|
||||
(add-after 'install 'install-completions
|
||||
(lambda* (#:key native-inputs #:allow-other-keys)
|
||||
(define bcachefs
|
||||
(or (false-if-exception (search-input-file native-inputs
|
||||
"sbin/bcachefs"))
|
||||
(string-append #$bcachefs-tools-target/release
|
||||
"/bcachefs")))
|
||||
|
||||
(define (output-completions shell file)
|
||||
(let ((output (string-append #$output "/" file)))
|
||||
(mkdir-p (dirname output))
|
||||
(with-output-to-file output
|
||||
(lambda _
|
||||
(invoke bcachefs "completions" shell)))))
|
||||
|
||||
(for-each (cut apply output-completions <>)
|
||||
'(("bash"
|
||||
"share/bash-completion/completions/bcachefs")
|
||||
("fish"
|
||||
"share/fish/vendor_completions.d/bcachefs.fish")
|
||||
("zsh"
|
||||
"share/zsh/site-functions/_bcachefs")))))))))
|
||||
(native-inputs
|
||||
(append (package-native-inputs bcachefs-tools-minimal)
|
||||
(if (%current-target-system)
|
||||
(list bcachefs-tools-minimal)
|
||||
(list))))))
|
||||
|
||||
(define-public bcachefs-tools/static
|
||||
(package
|
||||
(inherit bcachefs-tools)
|
||||
(inherit bcachefs-tools-minimal)
|
||||
(name "bcachefs-tools-static")
|
||||
(arguments
|
||||
(substitute-keyword-arguments (package-arguments bcachefs-tools)
|
||||
(substitute-keyword-arguments (package-arguments bcachefs-tools-minimal)
|
||||
((#:phases phases #~%standard-phases)
|
||||
#~(modify-phases #$phases
|
||||
(add-after 'configure 'set-rust-flags
|
||||
|
@ -752,7 +799,7 @@ (define-public bcachefs-tools/static
|
|||
(apply invoke "make" "install"
|
||||
(string-append "PREFIX=" #$output)
|
||||
#$bcachefs-tools-make-install-flags)))))))
|
||||
(inputs (modify-inputs (package-inputs bcachefs-tools)
|
||||
(inputs (modify-inputs (package-inputs bcachefs-tools-minimal)
|
||||
(prepend `(,eudev "static")
|
||||
`(,keyutils "static")
|
||||
`(,libscrypt "static")
|
||||
|
@ -781,8 +828,8 @@ (define-public bcachefs/static
|
|||
(home-page (package-home-page bcachefs-tools/static))
|
||||
(synopsis "Statically-linked bcachefs command from bcachefs-tools")
|
||||
(description
|
||||
"This package provides the statically-linked @command{bcachefs} from the
|
||||
bcachefs-tools package. It is meant to be used in initrds.")
|
||||
"This package provides the statically-linked @command{bcachefs} from a
|
||||
minimal bcachefs-tools package. It is meant to be used in initrds.")
|
||||
(license (package-license bcachefs-tools/static))))
|
||||
|
||||
(define-public exfatprogs
|
||||
|
|
Loading…
Reference in a new issue