This repository has been archived on 2026-03-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
nixos-exporter/flake.nix
Torjus Håkestad 5cc0e7eadd feat: add NATS cache sharing and smart cache refresh
Add two complementary features to reduce remote revision cache staleness:

1. Smart local cache: When current system revision matches cached remote
   revision, force an immediate cache refresh to check for newer revisions.

2. NATS integration: Share cache updates across hosts via NATS pub/sub.
   Hosts publish revision updates when they fetch new data, and subscribe
   to receive updates from other hosts. Features include:
   - Auto-reconnect with infinite retries
   - Graceful fallback when NATS unavailable
   - Filtering by flake URL and hostname

New CLI flags:
  --flake.nats.enable
  --flake.nats.url
  --flake.nats.subject
  --flake.nats.credentials-file

New NixOS module options under services.prometheus.exporters.nixos.flake.nats

Bumps version to 0.3.0.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 23:05:52 +01:00

60 lines
1.8 KiB
Nix

{
description = "Prometheus exporter for NixOS-specific metrics";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
outputs = { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
# Extract version from main.go
mainGo = builtins.readFile ./main.go;
lines = builtins.filter (x: builtins.isString x) (builtins.split "\n" mainGo);
versionLine = builtins.head (builtins.filter (line: builtins.match ".*const version = .*" line != null) lines);
version = builtins.head (builtins.match ".*\"([0-9.]+)\".*" versionLine);
in
{
packages = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = pkgs.buildGoModule {
pname = "nixos-exporter";
inherit version;
src = ./.;
vendorHash = "sha256-AVtGXeAmbc6ePLZgayWiqnGxxgg0ON1uG5ZzTjLjdwQ=";
meta = with pkgs.lib; {
description = "Prometheus exporter for NixOS-specific metrics";
homepage = "https://git.t-juice.club/torjus/nixos-exporter";
license = licenses.mit;
maintainers = [ ];
platforms = platforms.linux;
};
};
});
devShells = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = pkgs.mkShell {
buildInputs = with pkgs; [
go
gopls
golangci-lint
govulncheck
delve
];
};
});
nixosModules.default = import ./module.nix { inherit self; };
};
}