61 lines
944 B
Nix
61 lines
944 B
Nix
{
|
|
stdenv,
|
|
lib,
|
|
bats,
|
|
gitMinimal,
|
|
python3,
|
|
python3Packages,
|
|
shellcheck-minimal,
|
|
shfmt,
|
|
}:
|
|
|
|
let
|
|
fs = lib.fileset;
|
|
in
|
|
stdenv.mkDerivation {
|
|
pname = "mechanicaldiff";
|
|
version = "0.0.1";
|
|
|
|
src = fs.toSource {
|
|
root = ./.;
|
|
fileset = fs.unions [
|
|
./.editorconfig
|
|
./bin
|
|
./test
|
|
];
|
|
};
|
|
|
|
buildInputs = [ python3 ];
|
|
|
|
postPatch = ''
|
|
patchShebangs .
|
|
'';
|
|
|
|
doCheck = true;
|
|
|
|
nativeCheckInputs = [
|
|
(bats.withLibraries (p: [
|
|
p.bats-assert
|
|
p.bats-support
|
|
]))
|
|
gitMinimal
|
|
python3Packages.flake8
|
|
shellcheck-minimal
|
|
shfmt
|
|
];
|
|
|
|
checkPhase = ''
|
|
runHook preCheck
|
|
flake8 bin/mechanicaldiff.py
|
|
shellcheck test/mechanicaldiff.bats
|
|
shfmt -d test/mechanicaldiff.bats
|
|
bats test
|
|
runHook postCheck
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/bin
|
|
cp $src/bin/mechanicaldiff.py $out/bin/mechanicaldiff
|
|
chmod +x $out/bin/mechanicaldiff
|
|
'';
|
|
}
|