summaryrefslogtreecommitdiff
path: root/hooks/lib/update-zone-serials
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2024-08-07 19:01:27 -0600
committerAlejandro Soto <alejandro@34project.org>2024-08-07 19:03:18 -0600
commitda84be8c451308bbad0a70592bdcb0abd975f060 (patch)
tree1bc520803112252bae53b5de802c7cee7b62c92a /hooks/lib/update-zone-serials
parentbcf936e19f78fc69572f0b748e83783899a55467 (diff)
sys/ns: implement automatic zone serial updates with a pre-commit hook
Diffstat (limited to 'hooks/lib/update-zone-serials')
-rwxr-xr-xhooks/lib/update-zone-serials8
1 files changed, 8 insertions, 0 deletions
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