#!/usr/bin/env bash

echo "stashing all uncommitted changes"
git stash -q --keep-index

echo "checking flakes all compile"
nix flake check

if [ ! $? -eq 0 ]; then
    exit 1
fi

echo "running linter"
./lint.sh

RESULT=$?

echo "adding lint changes to commit"
git add -u

exit $RESULT