2023-05-12 23:23:33 +00:00
{ lib
, rustPlatform
, fetchFromGitHub
2023-05-19 15:11:51 +00:00
, stdenv
2024-03-09 08:25:38 +00:00
, installShellFiles
2023-05-12 23:23:33 +00:00
} :
2023-05-19 15:11:51 +00:00
2023-05-12 23:23:33 +00:00
rustPlatform . buildRustPackage rec {
pname = " a s t - g r e p " ;
2024-10-25 04:58:15 +00:00
version = " 0 . 2 8 . 1 " ;
2023-05-12 23:23:33 +00:00
src = fetchFromGitHub {
owner = " a s t - g r e p " ;
repo = " a s t - g r e p " ;
2023-06-20 04:17:53 +00:00
rev = version ;
2024-10-25 04:58:15 +00:00
hash = " s h a 2 5 6 - n M O j / o M J s B B 0 b I 2 R z x E y t v E r 0 v + V m G I M Y 0 u i K 7 A L E H M = " ;
2023-05-12 23:23:33 +00:00
} ;
2024-10-25 04:58:15 +00:00
cargoHash = " s h a 2 5 6 - a l O L d k g y r J Q N g / J A C r e d G m f s / d K x n O m 9 c S a h v V B H z T M = " ;
2023-05-12 23:23:33 +00:00
2024-03-09 08:25:38 +00:00
nativeBuildInputs = [ installShellFiles ] ;
2023-05-19 15:09:09 +00:00
# error: linker `aarch64-linux-gnu-gcc` not found
postPatch = ''
rm .cargo/config.toml
'' ;
2024-07-10 11:52:28 +00:00
postInstall = lib . optionalString ( stdenv . buildPlatform . canExecute stdenv . hostPlatform ) ''
2024-03-09 08:25:38 +00:00
installShellCompletion - - cmd sg \
- - bash < ( $ out/bin/sg completions bash ) \
- - fish < ( $ out/bin/sg completions fish ) \
- - zsh < ( $ out/bin/sg completions zsh )
'' ;
2023-07-17 04:20:00 +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 "
2023-09-30 03:18:24 +00:00
# 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 "
2023-09-30 16:30:29 +00:00
] ++ 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 "
2023-05-19 15:11:51 +00:00
] ;
2023-05-12 23:23:33 +00:00
meta = with lib ; {
mainProgram = " s g " ;
description = " 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 ;
2023-08-14 03:27:06 +00:00
maintainers = with maintainers ; [ montchr lord-valen cafkafk ] ;
2023-05-12 23:23:33 +00:00
} ;
}