blob: 7a68fa943b385e5903e1fa2e6fb033f75c83fb9a (
plain) (
tree)
|
|
#!/usr/bin/env bash
set -Eeuo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
cd ../
format() {
nix_file="${1}"
diff <(nixfmt < "${nix_file}") "${nix_file}" || {
echo "The file '${nix_file}' is unformatted. To fix it, run:"
echo " nixfmt ${nix_file}"
exit 1
}
}
export -f format
find . -type f -name '*.nix' -print0 | xargs -0 -I% bash -c "format %"
|