diff options
author | EuAndreh <eu@euandre.org> | 2020-10-11 03:56:30 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2020-10-11 04:19:20 -0300 |
commit | 6d2fae4d2749d893f5d027d5b4756e709a3847af (patch) | |
tree | d99d02b8039e233d2e5ae833b2752ef144274ffc /scripts/assert-nixfmt.sh | |
parent | Mark slides + article on feature flags as unpublished (diff) | |
download | euandre.org-6d2fae4d2749d893f5d027d5b4756e709a3847af.tar.gz euandre.org-6d2fae4d2749d893f5d027d5b4756e709a3847af.tar.xz |
Decouple testing with Nix
Use Nix for build isolation not for test running.
Diffstat (limited to '')
-rwxr-xr-x | scripts/assert-nixfmt.sh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/assert-nixfmt.sh b/scripts/assert-nixfmt.sh new file mode 100755 index 0000000..7a68fa9 --- /dev/null +++ b/scripts/assert-nixfmt.sh @@ -0,0 +1,16 @@ +#!/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 %" |