[TASK] Add check before commit that nix files have valid syntax
This commit is contained in:
parent
8f223fc83f
commit
cdf254a444
24
Makefile
Normal file
24
Makefile
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
MAKEFLAGS += --warn-undefined-variables
|
||||||
|
SHELL := $(shell which bash)
|
||||||
|
.EXPORT_ALL_VARIABLES:
|
||||||
|
.ONESHELL:
|
||||||
|
.SHELLFLAGS := -eu -o pipefail -c
|
||||||
|
.SILENT:
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: add-pre-commit-hook
|
||||||
|
add-pre-commit-hook:
|
||||||
|
printf '#!/bin/sh\nmake test\n' > .git/hooks/pre-commit
|
||||||
|
chmod +x .git/hooks/pre-commit
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: test
|
||||||
|
test:
|
||||||
|
echo "Find nix files"
|
||||||
|
find nixos -name "*.nix" | while read f; do
|
||||||
|
echo "Checking $$f"
|
||||||
|
nix-instantiate --parse "$$f" > /dev/null
|
||||||
|
done
|
||||||
|
echo "All files OK"
|
||||||
|
|
||||||
|
.DEFAULT_GOAL := test
|
||||||
Loading…
Reference in New Issue
Block a user