Commit 543b8a63d144

Vincent Demeester <vincent@sbr.pm>
2025-11-23 21:08:41
refactor: Consolidate DNS scripts into tools directory
- Improve repository organization by grouping all utilities in tools/ - Update make targets to reference new script locations - Document DNS management tools with comprehensive usage examples Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 89969dc
tools/README.org
@@ -4,6 +4,56 @@
 
 Collection of custom tools and utilities for system management and automation.
 
+* Shell Scripts
+
+** DNS Management
+
+*** show-dns.sh
+
+Display DNS zone configuration from NixOS bind configuration.
+
+*Usage:*
+#+begin_src shell
+# Show DNS zone for sbr.pm
+./show-dns.sh
+
+# Or via make target
+make dns-show
+#+end_src
+
+*Features:*
+- Reads DNS records from NixOS configuration
+- Displays formatted zone file output
+- Useful for verifying DNS configuration before sync
+
+*** update-gandi-dns.sh
+
+Synchronize DNS records from NixOS configuration to Gandi Live DNS.
+
+*Usage:*
+#+begin_src shell
+# Dry run to preview changes (requires GANDIV5_PERSONAL_TOKEN)
+./update-gandi-dns.sh --dry-run
+
+# Apply changes to Gandi DNS
+./update-gandi-dns.sh
+
+# Or via make targets
+make dns-update-gandi-dry-run
+make dns-update-gandi
+#+end_src
+
+*Features:*
+- Extracts A records from NixOS DNS zone configuration
+- Syncs records to Gandi Live DNS API using Bearer token authentication
+- Dry-run mode for safe preview of changes
+- Skips unchanged records to minimize API calls
+- Supports wildcard DNS records
+
+*Requirements:*
+- =GANDIV5_PERSONAL_TOKEN= environment variable (Gandi Personal Access Token)
+- On rhea: =source /run/agenix/gandi.env= to load token
+
 * Python Scripts
 
 ** Media Management (*arr Stack)
scripts/show-dns.sh → tools/show-dns.sh
File renamed without changes
scripts/update-gandi-dns.sh → tools/update-gandi-dns.sh
File renamed without changes
Makefile
@@ -108,15 +108,15 @@ keyboards:
 # DNS
 .PHONY: dns-show
 dns-show:
-	@bash scripts/show-dns.sh
+	@bash tools/show-dns.sh
 
 .PHONY: dns-update-gandi
 dns-update-gandi:
-	@bash scripts/update-gandi-dns.sh
+	@bash tools/update-gandi-dns.sh
 
 .PHONY: dns-update-gandi-dry-run
 dns-update-gandi-dry-run:
-	@bash scripts/update-gandi-dns.sh --dry-run
+	@bash tools/update-gandi-dns.sh --dry-run
 
 # Maintenance
 .PHONY: clean
README.org
@@ -46,10 +46,14 @@
 
 ** =/tools=
 Custom tools and utilities:
+- DNS management scripts (show-dns.sh, update-gandi-dns.sh)
+- Media management scripts (*arr stack automation)
 - Battery monitor
 - Emacs configuration
 - Various Go-based utilities
 
+See [[file:tools/README.org][tools/README.org]] for detailed tool documentation.
+
 ** =/pkgs=
 Custom Nix packages and overlays including:
 - Development tools (govanityurl, manifest-tool)
@@ -176,6 +180,13 @@
 
 See [[file:keyboards/README.org][keyboards/README.org]] for detailed keyboard documentation.
 
+*** DNS Management
+- =make dns-show= - Display DNS zone configuration from NixOS
+- =make dns-update-gandi= - Sync DNS records to Gandi Live DNS
+- =make dns-update-gandi-dry-run= - Preview DNS changes without applying
+
+See [[file:tools/README.org][tools/README.org]] for detailed DNS tool documentation.
+
 *** Maintenance
 - =make clean= - Clean up old system generations and results
 - =make clean-system= - Remove system generations older than 15 days