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.hostPlatform.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"
55 # Fails if the filesystem performs UTF-8 validation (such as ZFS with utf8only=on)
56 "--skip=file_with_invalid_utf8_filename"
59 doInstallCheck = true;
60 installCheckPhase = ''
61 runHook preInstallCheck
63 testFile=$(mktemp /tmp/bat-test.XXXX)
64 echo -ne 'Foobar\n\n\n42' > $testFile
65 $out/bin/bat -p $testFile | grep "Foobar"
66 $out/bin/bat -p $testFile -r 4:4 | grep 42
69 runHook postInstallCheck
73 description = "Cat(1) clone with syntax highlighting and Git integration";
74 homepage = "https://github.com/sharkdp/bat";
75 changelog = "https://github.com/sharkdp/bat/raw/v${version}/CHANGELOG.md";
76 license = with licenses; [ asl20 /* or */ mit ];
78 maintainers = with maintainers; [ dywedir zowoq SuperSandro2000 ];