2023-07-15 17:15:38 +00:00
{ lib
2024-01-02 11:29:13 +00:00
, stdenv
2023-07-15 17:15:38 +00:00
, rustPlatform
, fetchFromGitHub
, asciidoctor
, installShellFiles
, makeWrapper
, ripgrep
} :
rustPlatform . buildRustPackage rec {
pname = " r e p g r e p " ;
2024-01-02 11:29:13 +00:00
version = " 0 . 1 5 . 0 " ;
2023-07-15 17:15:38 +00:00
src = fetchFromGitHub {
owner = " a c h e r o n f a i l " ;
repo = " r e p g r e p " ;
rev = version ;
2024-01-02 11:29:13 +00:00
hash = " s h a 2 5 6 - 6 b a 7 E J U t s 0 N i 9 E A 3 E N l K + a 2 F a P o 7 J o h t C y q w R 9 D d L 1 E = " ;
2023-07-15 17:15:38 +00:00
} ;
2024-01-02 11:29:13 +00:00
cargoHash = " s h a 2 5 6 - X E j K T Z 3 q a i L W b m 2 w F + V 9 7 u 9 t G X D q / o T m 2 4 9 u b U E 9 n 9 4 = " ;
2023-07-15 17:15:38 +00:00
nativeBuildInputs = [
asciidoctor
installShellFiles
makeWrapper
] ;
postInstall = ''
wrapProgram $ out/bin/rgr \
- - prefix PATH : $ { lib . makeBinPath [ ripgrep ] }
pushd " $ ( d i r n a m e " $ ( find - path ' * * /repgrep-stamp ' | head - n 1 ) " ) "
installManPage rgr .1
popd
2024-01-02 11:29:13 +00:00
'' + l i b . o p t i o n a l S t r i n g ( s t d e n v . h o s t P l a t f o r m . c a n E x e c u t e s t d e n v . b u i l d P l a t f o r m ) ''
# As it can be seen here: https://github.com/acheronfail/repgrep/blob/0.15.0/.github/workflows/release.yml#L206, the completions are just the same as ripgrep
installShellCompletion - - cmd rgr \
- - bash < ( $ { lib . getExe ripgrep } - - generate complete-bash | sed ' s/-c rg/-c rgr / ' ) \
- - zsh < ( $ { lib . getExe ripgrep } - - generate complete-zsh | sed ' s/-c rg/-c rgr / ' ) \
- - fish < ( $ { lib . getExe ripgrep } - - generate complete-fish | sed ' s/-c rg/-c rgr / ' )
2023-07-15 17:15:38 +00:00
'' ;
meta = with lib ; {
description = " A n i n t e r a c t i v e r e p l a c e r f o r r i p g r e p t h a t m a k e s i t e a s y t o f i n d a n d r e p l a c e a c r o s s f i l e s o n t h e c o m m a n d l i n e " ;
homepage = " h t t p s : / / g i t h u b . c o m / a c h e r o n f a i l / r e p g r e p " ;
changelog = " h t t p s : / / g i t h u b . c o m / a c h e r o n f a i l / r e p g r e p / b l o b / ${ src . rev } / C H A N G E L O G . m d " ;
license = with licenses ; [ mit asl20 unlicense ] ;
maintainers = with maintainers ; [ figsoda ] ;
mainProgram = " r g r " ;
} ;
}