Add an optional Prometheus metrics HTTP endpoint to the listener for monitoring deployment operations. Includes four metrics: - homelab_deploy_deployments_total (counter with status/action/error_code) - homelab_deploy_deployment_duration_seconds (histogram with action/success) - homelab_deploy_deployment_in_progress (gauge) - homelab_deploy_info (gauge with hostname/tier/role/version) New CLI flags: --metrics-enabled, --metrics-addr (default :9972) New NixOS options: metrics.enable, metrics.address, metrics.openFirewall Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
56 lines
1.5 KiB
Nix
56 lines
1.5 KiB
Nix
{
|
|
description = "Message-based NixOS deployment system using NATS";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
|
};
|
|
|
|
outputs = { self, nixpkgs }:
|
|
let
|
|
supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
|
|
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
|
pkgsFor = system: nixpkgs.legacyPackages.${system};
|
|
in
|
|
{
|
|
packages = forAllSystems (system:
|
|
let
|
|
pkgs = pkgsFor system;
|
|
# Extract version from main.go
|
|
version = builtins.head (
|
|
builtins.match ''.*const version = "([^"]+)".*''
|
|
(builtins.readFile ./cmd/homelab-deploy/main.go)
|
|
);
|
|
in
|
|
{
|
|
homelab-deploy = pkgs.buildGoModule {
|
|
pname = "homelab-deploy";
|
|
inherit version;
|
|
src = ./.;
|
|
vendorHash = "sha256-CN+l0JbQu+HDfotkt3PUFzBexHCHpCKIIZpAQRyojBk=";
|
|
subPackages = [ "cmd/homelab-deploy" ];
|
|
};
|
|
default = self.packages.${system}.homelab-deploy;
|
|
});
|
|
|
|
devShells = forAllSystems (system:
|
|
let
|
|
pkgs = pkgsFor system;
|
|
in
|
|
{
|
|
default = pkgs.mkShell {
|
|
buildInputs = with pkgs; [
|
|
go
|
|
gopls
|
|
gotools
|
|
golangci-lint
|
|
govulncheck
|
|
delve
|
|
];
|
|
};
|
|
});
|
|
|
|
nixosModules.default = import ./nixos/module.nix { inherit self; };
|
|
nixosModules.homelab-deploy = self.nixosModules.default;
|
|
};
|
|
}
|