2023-10-09 19:29:22 +00:00
{ lib
, rustPlatform
, fetchFromGitHub
, stdenv
2024-04-21 15:54:59 +00:00
, installShellFiles
2023-10-09 19:29:22 +00:00
} :
rustPlatform . buildRustPackage rec {
pname = " a s t - g r e p " ;
2024-06-05 15:53:02 +00:00
version = " 0 . 2 2 . 5 " ;
2023-10-09 19:29:22 +00:00
src = fetchFromGitHub {
owner = " a s t - g r e p " ;
repo = " a s t - g r e p " ;
rev = version ;
2024-06-05 15:53:02 +00:00
hash = " s h a 2 5 6 - B B F 4 g n s Z m Q 3 6 N D X 7 X / C T G b 9 + N 7 9 S 5 l L m B a q 5 k e G e N f A = " ;
2023-10-09 19:29:22 +00:00
} ;
2024-06-05 15:53:02 +00:00
cargoHash = " s h a 2 5 6 - b p w Z 1 y D e e v j M l r L L B P Q a 9 H 5 N I N 9 9 o 3 9 k i c s O n p + k j 9 M = " ;
2024-01-02 11:29:13 +00:00
2024-04-21 15:54:59 +00:00
nativeBuildInputs = [ installShellFiles ] ;
2023-10-09 19:29:22 +00:00
# error: linker `aarch64-linux-gnu-gcc` not found
postPatch = ''
rm .cargo/config.toml
'' ;
2024-04-21 15:54:59 +00:00
postInstall = ''
installShellCompletion - - cmd sg \
- - bash < ( $ out/bin/sg completions bash ) \
- - fish < ( $ out/bin/sg completions fish ) \
- - zsh < ( $ out/bin/sg completions zsh )
'' ;
2023-10-09 19:29:22 +00:00
checkFlags = [
# disable flaky test
" - - s k i p = t e s t : : t e s t _ l o a d _ p a r s e r _ m a c "
# BUG: Broke by 0.12.1 update (https://github.com/NixOS/nixpkgs/pull/257385)
# Please check if this is fixed in future updates of the package
" - - s k i p = v e r i f y : : t e s t _ c a s e : : t e s t s : : t e s t _ u n m a t c h i n g _ i d "
] ++ lib . optionals ( with stdenv . hostPlatform ; ( isDarwin && isx86_64 ) || ( isLinux && isAarch64 ) ) [
# x86_64-darwin: source/benches/fixtures/json-mac.so\' (no such file), \'/private/tmp/nix-build-.../source/benches/fixtures/json-mac.so\' (mach-o file, but is an incompatible architecture (have \'arm64\', need \'x86_64h\' or \'x86_64\'))" })
# aarch64-linux: /build/source/benches/fixtures/json-linux.so: cannot open shared object file: No such file or directory"
" - - s k i p = t e s t : : t e s t _ l o a d _ p a r s e r "
" - - s k i p = t e s t : : t e s t _ r e g i s t e r _ l a n g "
] ;
meta = with lib ; {
mainProgram = " s g " ;
description = " A f a s t a n d p o l y g l o t t o o l f o r c o d e s e a r c h i n g , l i n t i n g , r e w r i t i n g a t l a r g e s c a l e " ;
homepage = " h t t p s : / / a s t - g r e p . g i t h u b . i o / " ;
changelog = " h t t p s : / / g i t h u b . c o m / a s t - g r e p / a s t - g r e p / b l o b / ${ src . rev } / C H A N G E L O G . m d " ;
license = licenses . mit ;
maintainers = with maintainers ; [ montchr lord-valen cafkafk ] ;
} ;
}