diff --git a/pkgs/by-name/pr/prometheus-tailscale-exporter/package.nix b/pkgs/by-name/pr/prometheus-tailscale-exporter/package.nix new file mode 100644 index 000000000000..742986d6f284 --- /dev/null +++ b/pkgs/by-name/pr/prometheus-tailscale-exporter/package.nix @@ -0,0 +1,53 @@ +{ + lib, + buildGoModule, + fetchFromGitHub, + nixosTests, + versionCheckHook, +}: + +buildGoModule rec { + pname = "tailscale-exporter"; + version = "0.2.5"; + + src = fetchFromGitHub { + owner = "adinhodovic"; + repo = "tailscale-exporter"; + tag = version; + hash = "sha256-6iQtGfQsXVmwFaSA7B1AG+kbtSyKVWFbEld1lMb0DnE="; + }; + + vendorHash = "sha256-Nbx6LyGGhdgI4oEtbyqhJ2H1lY6BfSL/ROH/Dh4UOk0="; + + subPackages = [ + "cmd/tailscale-exporter" + "collector" + ]; + + env.CGO_ENABLED = 0; + + ldflags = [ + "-s" + "-w" + "-X main.version=${version}" + ]; + + doInstallCheck = true; + nativeInstallCheckInputs = [ versionCheckHook ]; + versionCheckProgramArg = "version"; + + passthru.tests = { + inherit (nixosTests.prometheus-exporters) tailscale; + }; + + meta = { + description = "Tailscale Tailnet metric exporter for Prometheus"; + homepage = "https://github.com/adinhodovic/tailscale-exporter"; + changelog = "https://github.com/adinhodovic/tailscale-exporter/releases/tag/${src.tag}"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ + squat + ]; + mainProgram = "tailscale-exporter"; + }; +}