72 lines
1.2 KiB
Nix
72 lines
1.2 KiB
Nix
{
|
|
stdenv,
|
|
lib,
|
|
git,
|
|
gnused,
|
|
bash,
|
|
bats,
|
|
shellcheck-minimal,
|
|
gitMinimal,
|
|
makeWrapper,
|
|
}:
|
|
|
|
let
|
|
fs = lib.fileset;
|
|
in
|
|
stdenv.mkDerivation {
|
|
pname = "git-check-assertions";
|
|
version = "0.0.1";
|
|
|
|
src = fs.toSource {
|
|
root = ./.;
|
|
fileset = fs.unions [
|
|
./git-check-assertions
|
|
./test.bats
|
|
];
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
makeWrapper
|
|
];
|
|
|
|
postPatch = ''
|
|
patchShebangs .
|
|
'';
|
|
|
|
nativeCheckInputs = [
|
|
shellcheck-minimal
|
|
bats
|
|
gitMinimal
|
|
];
|
|
|
|
checkPhase = ''
|
|
runHook preCheck
|
|
shellcheck git-check-assertions test.bats
|
|
git init
|
|
git config user.email test
|
|
git config user.name test
|
|
git checkout -b main
|
|
git commit --allow-empty -m "initial"
|
|
./test.bats
|
|
runHook postCheck
|
|
'';
|
|
|
|
doCheck = true;
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
mkdir -p $out/bin
|
|
cp $src/git-check-assertions $out/bin/git-check-assertions
|
|
chmod +x $out/bin/git-check-assertions
|
|
wrapProgram $out/bin/git-check-assertions --prefix PATH : ${
|
|
lib.makeBinPath [
|
|
bash
|
|
gitMinimal
|
|
gnused
|
|
]
|
|
}
|
|
runHook postInstall
|
|
'';
|
|
|
|
meta.mainProgram = "git-check-assertions";
|
|
}
|