Newer
Older
percord / .husky / pre-commit
#!/usr/bin/env sh
#!nix-shell -i "bash" -p bash prefetch-npm-deps jq nodejs nix-output-monitor
. "$(dirname -- "$0")/_/husky.sh"

# Check if nix is available
if [ -x "$(/usr/bin/env which nix-shell 2>/dev/null)" ]; then
  # Check if we haven't re-executed ourselves yet
  if [ ! "$HOOK_NIX_SHELL" ]; then
    echo "Nix is available, updating nix flake..."
    export HOOK_NIX_SHELL=1
    nix-shell $0
    exit $?
  else
    nix flake update --extra-experimental-features 'nix-command flakes'
  fi
else
  echo "You do not appear to have nix installed. Skipping update of nix dependencies."
fi

npx -y lint-staged