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

https://github.com/NixOS/nixpkgs-channels · Nix · 43 lines · 35 code · 8 blank · 0 comment · 0 complexity · db13c6c67c4d941b53bf77111cf16b90 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.1";
  13. src = fetchFromGitHub {
  14. owner = "BurntSushi";
  15. repo = pname;
  16. rev = version;
  17. sha256 = "1hqps7l5qrjh9f914r5i6kmcz6f1yb951nv4lby0cjnp5l253kps";
  18. };
  19. cargoSha256 = "03wf9r2csi6jpa7v5sw5lpxkrk4wfzwmzx7k3991q3bdjzcwnnwp";
  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 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 zowoq ];
  34. };
  35. }