Files
nixpkgs/pkgs/by-name/ba/bashunit/package.nix
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

78 lines
1.7 KiB
Nix

{
stdenvNoCC,
lib,
fetchFromGitHub,
bash,
which,
versionCheckHook,
coreutils,
makeBinaryWrapper,
nix-update-script,
}:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "bashunit";
version = "0.24.0";
src = fetchFromGitHub {
owner = "TypedDevs";
repo = "bashunit";
tag = finalAttrs.version;
hash = "sha256-TIt1EG/KQCslwZH9seF5SUgH242ZkUkWf8HWqNBIrD0=";
forceFetchGit = true; # needed to include the tests directory for the check phase
};
nativeBuildInputs = [ makeBinaryWrapper ];
postConfigure = ''
patchShebangs tests build.sh bashunit
substituteInPlace Makefile \
--replace-fail "SHELL=/bin/bash" "SHELL=${lib.getExe bash}"
'';
buildPhase = ''
runHook preBuild
./build.sh
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -m755 -D bin/bashunit $out/bin/bashunit
runHook postInstall
'';
doCheck = true;
nativeCheckInputs = [ which ];
checkPhase = ''
runHook preCheck
make test
runHook postCheck
'';
postFixup = ''
wrapProgram $out/bin/bashunit \
--prefix PATH : "${
lib.makeBinPath [
coreutils
which
]
}"
'';
nativeInstallCheckInputs = [ versionCheckHook ];
doInstallCheck = true;
versionCheckProgramArg = "--version";
passthru.updateScript = nix-update-script { };
meta = {
description = "Simple testing framework for bash scripts";
homepage = "https://bashunit.typeddevs.com";
changelog = "https://github.com/TypedDevs/bashunit/releases/tag/${finalAttrs.version}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ tricktron ];
mainProgram = "bashunit";
};
})