When running nix flake metadata, nix and git need writable cache
directories. System service users have home set to /var/empty which
is read-only, causing "cannot create directories" errors.
Add StateDirectory and set HOME/XDG_CACHE_HOME environment variables
to /var/lib/nixos-exporter when flake collector is enabled.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The systemd service runs in a sandboxed environment without the usual
PATH. Add nix and git to the service path when flake collector is
enabled so it can run `nix flake metadata` on git+https:// URLs.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>