Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv, lib, fetchFromGitHub, rustPlatform, makeWrapper, ffmpeg 2, pandoc, poppler_utils, ripgrep, Security, imagemagick, tesseract3 3}: 4 5rustPlatform.buildRustPackage rec { 6 pname = "ripgrep-all"; 7 version = "0.9.6"; 8 9 src = fetchFromGitHub { 10 owner = "phiresky"; 11 repo = pname; 12 rev = "v${version}"; 13 sha256 = "1wjpgi7m3lxybllkr3r60zaphp02ykq2syq72q9ail2760cjcir6"; 14 }; 15 16 cargoSha256 = "1l71xj5crfb51wfp2bdvdqp1l8kg182n5d6w23lq2wjszaqcj7cw"; 17 nativeBuildInputs = [ makeWrapper ]; 18 buildInputs = lib.optional stdenv.isDarwin Security; 19 20 postInstall = '' 21 wrapProgram $out/bin/rga \ 22 --prefix PATH ":" "${lib.makeBinPath [ ffmpeg pandoc poppler_utils ripgrep imagemagick tesseract3 ]}" 23 ''; 24 25 # Use upstream's example data to run a couple of queries to ensure the dependencies 26 # for all of the adapters are available. 27 installCheckPhase = '' 28 set -e 29 export PATH="$PATH:$out/bin" 30 31 test1=$(rga --rga-no-cache "hello" exampledir/ | wc -l) 32 test2=$(rga --rga-no-cache --rga-adapters=tesseract "crate" exampledir/screenshot.png | wc -l) 33 34 if [ $test1 != 26 ] 35 then 36 echo "ERROR: test1 failed! Could not find the word 'hello' 26 times in the sample data." 37 exit 1 38 fi 39 40 if [ $test2 != 1 ] 41 then 42 echo "ERROR: test2 failed! Could not find the word 'crate' in the screenshot." 43 exit 1 44 fi 45 ''; 46 47 doInstallCheck = true; 48 49 meta = with lib; { 50 description = "Ripgrep, but also search in PDFs, E-Books, Office documents, zip, tar.gz, and more"; 51 longDescription = '' 52 Ripgrep, but also search in PDFs, E-Books, Office documents, zip, tar.gz, etc. 53 54 rga is a line-oriented search tool that allows you to look for a regex in 55 a multitude of file types. rga wraps the awesome ripgrep and enables it 56 to search in pdf, docx, sqlite, jpg, movie subtitles (mkv, mp4), etc. 57 ''; 58 homepage = "https://github.com/phiresky/ripgrep-all"; 59 license = with licenses; [ agpl3Plus ]; 60 maintainers = with maintainers; [ zaninime ma27 ]; 61 mainProgram = "rga"; 62 }; 63}