(define-module (ruther packages ripgrep-all)
#:use-module (srfi srfi-26)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix utils)
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix git-download)
#:use-module (guix download)
#:use-module (gnu packages video)
#:use-module (gnu packages haskell-xyz)
#:use-module (gnu packages pdf)
#:use-module (gnu packages rust-apps)
#:use-module (gnu packages compression)
#:use-module (gnu packages terminals)
#:use-module (gnu packages pkg-config)
#:use-module (guix build-system cargo)
#:use-module (ruther packages rust-crates))
(define-public ripgrep-all
(let ((wrap-paths-packages
(list ffmpeg
pandoc
poppler
ripgrep
zip
fzf))
(wrap-paths
(list "ffmpeg"
"pandoc"
"poppler"
"ripgrep"
"zip"
"fzf")))
(package
(name "ripgrep-all")
(version "0.10.6")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/phiresky/ripgrep-all")
(commit (string-append "v" version))))
(file-name (string-append name "-" version "-checkout"))
(sha256
(base32 "0ws0shf0y5z8wxaanlwjrpq604saffj1gr5jsfmvs6r2p4px3kly"))))
(build-system cargo-build-system)
(native-inputs
(list
pkg-config
xz))
(inputs
`((,zstd "lib")
,@wrap-paths-packages
,@(my-cargo-inputs 'ripgrep-all)))
(arguments
(list
#:install-source? #f
#:phases
#~(modify-phases %standard-phases
(add-after 'configure 'use-guix-vendored-dependencies
(lambda _
(substitute* "Cargo.toml"
(("git.*}")
"version = \"*\" }"))
(let ((git-managed-dep #$(this-package-input "rust-tokio-tar-0.3.1.87338a7-checkout")))
(copy-recursively git-managed-dep
(string-append "guix-vendor/" (strip-store-file-name git-managed-dep))))))
(add-after 'install 'wrap-with-paths
(lambda* _
(let* ((bin-dir (string-append #$output "/bin/"))
(wrap-bin-folders
(map (lambda (pkg) (string-append pkg "/bin"))
'#$(map (cut this-package-input <>) wrap-paths)))
(wrap-bin-path (string-join wrap-bin-folders ":")))
(for-each (lambda (bin)
(wrap-program bin
`("PATH" ":" prefix
(,wrap-bin-path)))) (find-files bin-dir)))))
)
#:cargo-test-flags
`(list
"--release" "--"
"--skip=adapters::mbox::tests::mail_simple"
"--skip=adapters::mbox::tests::mbox_simple"
"--skip=adapters::mbox::tests::mbox_attachment")))
(home-page "https://github.com/phiresky/ripgrep-all")
(synopsis
"rga: ripgrep, but also search in PDFs, E-Books, Office documents, zip, tar.gz, etc")
(description
"This package provides rga: ripgrep, but also search in PDFs, E-Books, Office documents, zip, tar.gz,
etc.")
(license license:agpl3+))))