1
1
forked from extern/flakelight

Clean up git pre-commit hook package

This commit is contained in:
Archit Gupta 2023-04-16 16:51:08 -07:00
parent 1c8ac213b0
commit 3a26542b83
3 changed files with 6 additions and 7 deletions

View File

@ -3,7 +3,7 @@ _: {
if [ -f flake.nix ] && [ -d .git/hooks ] &&
[ ! -f .git/hooks/pre-commit ]; then
echo Installing git pre-commit hook...
cp ${lib.getExe flakelite.inputs'.flakelite.packages.pre-commit
cp ${lib.getExe flakelite.inputs'.flakelite.packages.pre-commit-hook
} .git/hooks
fi
'';

View File

@ -1,5 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
TREE=$(mktemp -d)
git archive "$(git write-tree)" | tar -xC "$TREE"
nix flake check "$TREE"

View File

@ -6,5 +6,9 @@
writeShellApplication {
name = "pre-commit";
runtimeInputs = [ nix git gnutar ];
text = builtins.readFile ./pre-commit;
text = ''
TREE=$(mktemp -d)
git archive "$(git write-tree)" | tar -xC "$TREE"
nix flake check "$TREE"
'';
}