diff options
Diffstat (limited to '')
| -rw-r--r-- | hooks/README | 2 | ||||
| -rwxr-xr-x | hooks/lib/update-zone-serials | 8 | ||||
| -rwxr-xr-x | hooks/pre-commit | 8 |
3 files changed, 18 insertions, 0 deletions
diff --git a/hooks/README b/hooks/README new file mode 100644 index 0000000..176dc1c --- /dev/null +++ b/hooks/README @@ -0,0 +1,2 @@ +$ git config core.hooksPath hooks +$ man githooks diff --git a/hooks/lib/update-zone-serials b/hooks/lib/update-zone-serials new file mode 100755 index 0000000..272d5f6 --- /dev/null +++ b/hooks/lib/update-zone-serials @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + +nix eval --json '.#nixosConfigurations.gate.config.lib.local.zoneSerialUpdates' \ + | nix run '.#increment-zone-serials' -- sys/ns/zones \ + | while read file; do nix fmt -- "$file"; git add -v -- "$file"; done diff --git a/hooks/pre-commit b/hooks/pre-commit new file mode 100755 index 0000000..93e9b9a --- /dev/null +++ b/hooks/pre-commit @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -e +exec >&2 + +if git diff-index --cached HEAD -- | grep -q $'\tsys/ns/'; then + exec hooks/lib/update-zone-serials +fi |
