Files
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

88 lines
2.1 KiB
Nix

{
lib,
fetchFromGitHub,
stdenv,
bash,
bat,
fish,
getconf,
nix-update-script,
zsh,
}:
stdenv.mkDerivation rec {
pname = "bat-extras";
version = "2024.08.24";
src = fetchFromGitHub {
owner = "eth-p";
repo = "bat-extras";
tag = "v${version}";
hash = "sha256-xkND/w6UNC58dC8WrsifwjqU9ZI4yUUq+ZljkhhUNT8=";
fetchSubmodules = true;
};
# bat needs to be in the PATH during building so EXECUTABLE_BAT picks it up
nativeBuildInputs = [ bat ];
dontConfigure = true;
patches = [ ../patches/disable-theme-tests.patch ];
postPatch = ''
patchShebangs --build test.sh test/shimexec .test-framework/bin/best.sh
'';
buildPhase = ''
runHook preBuild
bash ./build.sh --minify=none --no-verify
runHook postBuild
'';
# Run the library tests as they don't have external dependencies
doCheck = true;
nativeCheckInputs = [
bash
fish
zsh
]
++ (lib.optionals stdenv.hostPlatform.isDarwin [ getconf ]);
checkPhase = ''
runHook preCheck
# test list repeats suites. Unique them
declare -A test_suites
while read -r action arg _; do
[[ "$action" == "test_suite" && "$arg" == lib_* ]] &&
test_suites+=(["$arg"]=1)
done <<<"$(./test.sh --compiled --list --porcelain)"
(( ''${#test_suites[@]} != 0 )) || {
echo "Couldn't find any library test suites"
exit 1
}
./test.sh --compiled $(printf -- "--suite %q\n" "''${!test_suites[@]}")
runHook postCheck
'';
installPhase = ''
runHook preInstall
cp -a . $out
runHook postInstall
'';
# A few random files have shebangs. Don't patch them, they don't make it into the final output.
# The per-script derivations will go ahead and patch the files they actually install.
dontPatchShebangs = true;
passthru.updateScript = nix-update-script { };
meta = {
description = "Bash scripts that integrate bat with various command line tools";
homepage = "https://github.com/eth-p/bat-extras";
license = with lib.licenses; [ mit ];
maintainers = with lib.maintainers; [
bbigras
perchun
];
platforms = lib.platforms.all;
};
}