Skip to content

Commit

Permalink
Merge pull request cachix#309 from Enzime/fix/nil
Browse files Browse the repository at this point in the history
nil: Fix hook only failing if last file fails
  • Loading branch information
domenkozar authored May 29, 2023
2 parents 8e2c1a5 + da69577 commit ca2fdbf
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions modules/hooks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -731,9 +731,20 @@ in
entry =
let
script = pkgs.writeShellScript "precommit-nil" ''
errors=false
echo Checking: $@
for file in $(echo "$@"); do
${tools.nil}/bin/nil diagnostics "$file"
exit_code=$?
if [[ $exit_code -ne 0 ]]; then
echo \"$file\" failed with exit code: $exit_code
errors=true
fi
done
if [[ $errors == true ]]; then
exit 1
fi
'';
in
builtins.toString script;
Expand Down

0 comments on commit ca2fdbf

Please sign in to comment.