From 137a5e4a1631d69f6844c8dab0b5d629db01c11c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 23 Oct 2020 08:41:58 -0300 Subject: Add bash scripts for tests instead of Nix --- scripts/assert-nixfmt.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 scripts/assert-nixfmt.sh (limited to 'scripts/assert-nixfmt.sh') 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 %" -- cgit v1.2.3