/pkgs/tools/text/ripgrep/default.nix

https://github.com/DamienCassou/nixpkgs · Nix · 44 lines · 36 code · 8 blank · 0 comment · 0 complexity · 112d41187657f0109228dfb5de4a3e42 MD5 · raw file

  1. { stdenv
  2. , fetchFromGitHub
  3. , rustPlatform
  4. , asciidoctor
  5. , installShellFiles
  6. , Security
  7. , withPCRE2 ? true
  8. , pcre2 ? null
  9. }:
  10. rustPlatform.buildRustPackage rec {
  11. pname = "ripgrep";
  12. version = "12.1.0";
  13. src = fetchFromGitHub {
  14. owner = "BurntSushi";
  15. repo = pname;
  16. rev = version;
  17. sha256 = "1vgkk78c25ia9y4q5psrh7xrlbfdn7dz7bc20kci40n8zr0vjwww";
  18. };
  19. cargoSha256 = "143lnf4yah9ik7v8rphv7gbvr2ckhjpmy8zfgqml1n3fqxiqvxnb";
  20. cargoBuildFlags = stdenv.lib.optional withPCRE2 "--features pcre2";
  21. nativeBuildInputs = [ asciidoctor installShellFiles ];
  22. buildInputs = (stdenv.lib.optional withPCRE2 pcre2)
  23. ++ (stdenv.lib.optional stdenv.isDarwin Security);
  24. preFixup = ''
  25. installManPage $releaseDir/build/ripgrep-*/out/rg.1
  26. installShellCompletion $releaseDir/build/ripgrep-*/out/rg.{bash,fish}
  27. installShellCompletion --zsh "$src/complete/_rg"
  28. '';
  29. meta = with stdenv.lib; {
  30. description = "A utility that combines the usability of The Silver Searcher with the raw speed of grep";
  31. homepage = "https://github.com/BurntSushi/ripgrep";
  32. license = with licenses; [ unlicense /* or */ mit ];
  33. maintainers = with maintainers; [ tailhook globin ma27 ];
  34. platforms = platforms.all;
  35. };
  36. }