Files
server/.husky/pre-commit
2026-01-11 16:31:22 +01:00

25 lines
807 B
Bash
Executable File

#!/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 [ -n "$(find "flake.lock" -mtime +7 -print)" ]; then
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' -vL
git add flake.lock
fi
else
echo "You do not appear to have nix installed. Skipping update of nix dependencies."
fi
else
echo "Nix flake lock was updated less than 7 days ago. Skipping update."
fi
npx -y lint-staged