Merge pull request #328451 from d-brasher/init-zunit

zunit: init at 0.8.2
This commit is contained in:
Peder Bergebakken Sundt 2024-08-12 00:03:58 +02:00 committed by GitHub
commit 312b0ceec0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,95 @@
{
lib,
stdenvNoCC,
fetchFromGitHub,
zsh,
revolver,
installShellFiles,
testers,
nix-update-script,
}:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "zunit";
version = "0.8.2";
src = fetchFromGitHub {
owner = "zunit-zsh";
repo = "zunit";
rev = "v${finalAttrs.version}";
hash = "sha256-GkBewb795piCaniZJZpGEZFhKaNs8p8swV5z34OegPY=";
deepClone = true; # Needed in order to get "tests" folder
};
strictDeps = true;
doCheck = true;
doInstallCheck = true;
nativeBuildInputs = [
zsh
installShellFiles
];
nativeCheckInputs = [ revolver ];
buildInputs = [
zsh
revolver
];
postPatch = ''
for i in $(find src/ -type f -print); do
substituteInPlace $i \
--replace-warn " revolver " " ${lib.getExe revolver} "
done
'';
buildPhase = ''
runHook preBuild
zsh build.zsh
runHook postBuild
'';
checkPhase = ''
runHook preCheck
HOME="$TEMPDIR" zsh zunit
runHook postCheck
'';
installPhase = ''
runHook preInstall
install -Dm755 zunit $out/bin/zunit
runHook postInstall
'';
postInstall = ''
installShellCompletion --cmd zunit --zsh zunit.zsh-completion
'';
installCheckPhase = ''
runHook preInstallCheck
PATH=$PATH:$out/bin zunit --help
runHook postInstallCheck
'';
passthru = {
tests.version = testers.testVersion { package = finalAttrs.finalPackage; };
updateScript = nix-update-script { };
};
meta = {
description = "Powerful testing framework for ZSH projects";
homepage = "https://zunit.xyz/";
downloadPage = "https://github.com/zunit-zsh/zunit/releases";
license = lib.licenses.mit;
mainProgram = "zunit";
inherit (zsh.meta) platforms;
maintainers = with lib.maintainers; [ d-brasher ];
};
})