78 lines
1.3 KiB
Nix
78 lines
1.3 KiB
Nix
{
|
|
stdenv,
|
|
lib,
|
|
git,
|
|
gnused,
|
|
bash,
|
|
bats,
|
|
shellcheck-minimal,
|
|
gitMinimal,
|
|
resholve,
|
|
shfmt,
|
|
}:
|
|
|
|
let
|
|
fs = lib.fileset;
|
|
in
|
|
resholve.mkDerivation {
|
|
pname = "git-check-assertions";
|
|
version = "0.0.1";
|
|
|
|
src = fs.toSource {
|
|
root = ./.;
|
|
fileset = fs.unions [
|
|
./.editorconfig
|
|
./bin
|
|
./test
|
|
];
|
|
};
|
|
|
|
postPatch = ''
|
|
patchShebangs .
|
|
'';
|
|
|
|
nativeCheckInputs = [
|
|
shellcheck-minimal
|
|
(bats.withLibraries (p: [
|
|
p.bats-assert
|
|
p.bats-support
|
|
p.bats-file
|
|
]))
|
|
gitMinimal
|
|
shfmt
|
|
];
|
|
|
|
checkPhase = ''
|
|
runHook preCheck
|
|
shellcheck bin/git-check-assertions test/git-check-assertions.bats
|
|
shfmt -d bin/git-check-assertions test/git-check-assertions.bats
|
|
./test/git-check-assertions.bats
|
|
runHook postCheck
|
|
'';
|
|
|
|
doCheck = true;
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
mkdir -p $out/bin
|
|
cp bin/git-check-assertions $out/bin/git-check-assertions
|
|
runHook postInstall
|
|
'';
|
|
|
|
solutions.default = {
|
|
scripts = [ "bin/git-check-assertions" ];
|
|
interpreter = lib.getExe bash;
|
|
inputs = [
|
|
gitMinimal
|
|
gnused
|
|
bash
|
|
];
|
|
execer = [
|
|
# Not true at all, but ¯\_(ツ)_/¯
|
|
"cannot:${lib.getExe bash}"
|
|
"cannot:${lib.getExe gitMinimal}"
|
|
];
|
|
};
|
|
|
|
meta.mainProgram = "git-check-assertions";
|
|
}
|