13 rustPlatform.buildRustPackage rec {
17 src = fetchFromGitHub {
21 hash = "sha256-1RjlJEmY/jMf0IYQbrWrT1CHFyiqgarOl72u9xjjQiQ=";
23 cargoHash = "sha256-b7wNWdKQ4QLeCf7bNZRfzT9hD/D/oDglU7Xyb65IrGY=";
25 nativeBuildInputs = [ pkg-config installShellFiles makeWrapper ];
27 buildInputs = lib.optionals stdenv.isDarwin [ libiconv darwin.apple_sdk.frameworks.Security ];
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 # Skip test cases which depends on `more`
43 "--skip=alias_pager_disable_long_overrides_short"
44 "--skip=config_read_arguments_from_file"
45 "--skip=env_var_bat_paging"
46 "--skip=pager_arg_override_env_noconfig"
47 "--skip=pager_arg_override_env_withconfig"
49 "--skip=pager_basic_arg"
50 "--skip=pager_env_bat_pager_override_config"
51 "--skip=pager_env_pager_nooverride_config"
54 "--skip=pager_overwrite"
57 doInstallCheck = true;
58 installCheckPhase = ''
59 runHook preInstallCheck
61 testFile=$(mktemp /tmp/bat-test.XXXX)
62 echo -ne 'Foobar\n\n\n42' > $testFile
63 $out/bin/bat -p $testFile | grep "Foobar"
64 $out/bin/bat -p $testFile -r 4:4 | grep 42
67 runHook postInstallCheck
71 description = "A cat(1) clone with syntax highlighting and Git integration";
72 homepage = "https://github.com/sharkdp/bat";
73 changelog = "https://github.com/sharkdp/bat/raw/v${version}/CHANGELOG.md";
74 license = with licenses; [ asl20 /* or */ mit ];
76 maintainers = with maintainers; [ dywedir lilyball zowoq SuperSandro2000 ];