Commit Graph

6 Commits

Author SHA1 Message Date
86eaeb4b2a fix: use configuration-revision for current_rev in flake info metric
The nixos_flake_info metric's current_rev label was incorrectly showing
the nixpkgs input revision (from /run/current-system/nixos-version)
instead of the flake's own revision.

Now reads from /run/current-system/configuration-revision which contains
the flake's self.rev when system.configurationRevision is set in the
NixOS configuration.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 00:27:38 +01:00
9c29505814 feat: add nixos_flake_info metric with current and remote revisions
Add a new info metric that exposes the current system's flake revision
and the latest remote revision as labels. This makes it easier to see
exactly which revision is deployed vs available.

Also adds version constant to Go code and extracts it in flake.nix,
providing a single source of truth for the version.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 00:16:19 +01:00
d4b9577070 fix: allow AF_UNIX sockets for nix daemon communication
The flake collector needs Unix domain sockets to communicate with the
nix daemon. The RestrictAddressFamilies hardening was blocking this.
Also trim trailing newlines from stderr in error messages.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 23:33:15 +01:00
a065eab759 fix: improve error messages for flake metadata command
Capture stderr from nix flake metadata to show the actual error
message instead of just "exit status 1".

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 23:21:52 +01:00
858e047bff fix: add timeouts to prevent denial of service
Add 30-second timeout to nix flake metadata command to prevent hanging
on slow or unresponsive remotes. Add HTTP server timeouts (read, write,
idle) to protect against slowloris-style attacks.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 22:58:05 +01:00
f637da487c feat: implement nixos-exporter
Prometheus exporter for NixOS-specific metrics including:
- Generation collector: count, current, booted, age, config mismatch
- Flake collector: input age, input info, revision behind

Includes NixOS module, flake packaging, and documentation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 22:52:28 +01:00