13 rustPlatform.buildRustPackage rec {
17 src = fetchFromGitHub {
21 sha256 = "sha256-xkGGnWjuZ5ZR4Ll+JwgWyKZFboFZ6HKA8GviR3YBAnM=";
23 cargoSha256 = "sha256-ye6GH4pcI9h1CNpobUzfJ+2WlqJ98saCdD77AtSGafg=";
25 nativeBuildInputs = [ pkg-config installShellFiles makeWrapper ];
27 buildInputs = lib.optionals stdenv.isDarwin [ Security libiconv ];
30 installManPage $releaseDir/build/bat-*/out/assets/manual/bat.1
31 installShellCompletion $releaseDir/build/bat-*/out/assets/completions/bat.{bash,fish,zsh}
34 # Insert Nix-built `less` into PATH because the system-provided one may be too old to behave as
35 # expected with certain flag combinations.
37 wrapProgram "$out/bin/bat" \
38 --prefix PATH : "${lib.makeBinPath [ less ]}"
41 checkFlags = [ "--skip=pager_more" "--skip=pager_most" ];
43 doInstallCheck = true;
44 installCheckPhase = ''
45 runHook preInstallCheck
47 testFile=$(mktemp /tmp/bat-test.XXXX)
48 echo -ne 'Foobar\n\n\n42' > $testFile
49 $out/bin/bat -p $testFile | grep "Foobar"
50 $out/bin/bat -p $testFile -r 4:4 | grep 42
53 runHook postInstallCheck
57 description = "A cat(1) clone with syntax highlighting and Git integration";
58 homepage = "https://github.com/sharkdp/bat";
59 changelog = "https://github.com/sharkdp/bat/raw/v${version}/CHANGELOG.md";
60 license = with licenses; [ asl20 /* or */ mit ];
61 maintainers = with maintainers; [ dywedir lilyball zowoq SuperSandro2000 ];