From 43ad3d0f84925345d777af1fc1226cae68becc04 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 17 Mar 2025 01:38:46 +0000 Subject: [PATCH] flake.lock: Update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'nixpkgs': 'github:nixos/nixpkgs/eb62e6aa39ea67e0b8018ba8ea077efe65807dc8?narHash=sha256-uQ%2BNQ0/xYU0N1CnXsa2zghgNaOPxWpMJXSUJJ9W7140%3D' (2025-01-14) → 'github:nixos/nixpkgs/c80f6a7e10b39afcc1894e02ef785b1ad0b0d7e5?narHash=sha256-C7jVfohcGzdZRF6DO%2BybyG/sqpo1h6bZi9T56sxLy%2Bk%3D' (2025-03-15) --- flake.nix | 4 - patches/prometheusnodecertexporter.nix | 219 ------------------------- 2 files changed, 223 deletions(-) delete mode 100644 patches/prometheusnodecertexporter.nix diff --git a/flake.nix b/flake.nix index 01d3531..fd16815 100644 --- a/flake.nix +++ b/flake.nix @@ -20,10 +20,6 @@ # url = "https://github.com/NixOS/nixpkgs/pull/317107.patch"; # hash = "sha256-hoLrqV7XtR1hP/m0rV9hjYUBtrSjay0qcPUYlKKuVWk="; # }) - - # Remove when this PR is merged: - # https://github.com/NixOS/nixpkgs/pull/368325 - ./patches/prometheusnodecertexporter.nix ]; patchedNixpkgs = originPkgs.applyPatches { name = "nixpkgs-patched"; diff --git a/patches/prometheusnodecertexporter.nix b/patches/prometheusnodecertexporter.nix deleted file mode 100644 index 03e2004..0000000 --- a/patches/prometheusnodecertexporter.nix +++ /dev/null @@ -1,219 +0,0 @@ -index f805920c5b87a..b67f41c4fb12c 100644 ---- a/nixos/modules/services/monitoring/prometheus/exporters.nix -+++ b/nixos/modules/services/monitoring/prometheus/exporters.nix -@@ -66,6 +66,7 @@ let - "nginx" - "nginxlog" - "node" -+ "node-cert" - "nut" - "nvidia-gpu" - "pgbouncer" -diff --git a/nixos/modules/services/monitoring/prometheus/exporters/node-cert.nix b/nixos/modules/services/monitoring/prometheus/exporters/node-cert.nix -new file mode 100644 -index 0000000000000..d8b2004e8e857 ---- /dev/null -+++ b/nixos/modules/services/monitoring/prometheus/exporters/node-cert.nix -@@ -0,0 +1,70 @@ -+{ -+ config, -+ lib, -+ pkgs, -+ ... -+}: -+ -+let -+ cfg = config.services.prometheus.exporters.node-cert; -+ inherit (lib) mkOption types concatStringsSep; -+in -+{ -+ port = 9141; -+ -+ extraOpts = { -+ paths = mkOption { -+ type = types.listOf types.str; -+ description = '' -+ List of paths to search for SSL certificates. -+ ''; -+ }; -+ -+ excludePaths = mkOption { -+ type = types.listOf types.str; -+ description = '' -+ List of paths to exclute from searching for SSL certificates. -+ ''; -+ default = [ ]; -+ }; -+ -+ includeGlobs = mkOption { -+ type = types.listOf types.str; -+ description = '' -+ List files matching a pattern to include. Uses Go blob pattern. -+ ''; -+ default = [ ]; -+ }; -+ -+ excludeGlobs = mkOption { -+ type = types.listOf types.str; -+ description = '' -+ List files matching a pattern to include. Uses Go blob pattern. -+ ''; -+ default = [ ]; -+ }; -+ -+ user = mkOption { -+ type = types.str; -+ description = '' -+ User owning the certs. -+ ''; -+ default = "acme"; -+ }; -+ }; -+ -+ serviceOpts = { -+ serviceConfig = { -+ User = cfg.user; -+ ExecStart = '' -+ ${lib.getExe pkgs.prometheus-node-cert-exporter} \ -+ --listen ${toString cfg.listenAddress}:${toString cfg.port} \ -+ --path ${concatStringsSep "," cfg.paths} \ -+ --exclude-path "${concatStringsSep "," cfg.excludePaths}" \ -+ --include-glob "${concatStringsSep "," cfg.includeGlobs}" \ -+ --exclude-glob "${concatStringsSep "," cfg.excludeGlobs}" \ -+ ${concatStringsSep " \\\n " cfg.extraFlags} -+ ''; -+ }; -+ }; -+} -diff --git a/nixos/tests/prometheus-exporters.nix b/nixos/tests/prometheus-exporters.nix -index c15a3fd20b021..f59d61e69b92e 100644 ---- a/nixos/tests/prometheus-exporters.nix -+++ b/nixos/tests/prometheus-exporters.nix -@@ -1002,6 +1002,49 @@ let - ''; - }; - -+ node-cert = { -+ nodeName = "node_cert"; -+ exporterConfig = { -+ enable = true; -+ paths = ["/run/certs"]; -+ }; -+ exporterTest = '' -+ wait_for_unit("prometheus-node-cert-exporter.service") -+ wait_for_open_port(9141) -+ wait_until_succeeds( -+ "curl -sSf http://localhost:9141/metrics | grep 'ssl_certificate_expiry_seconds{.\\+path=\"/run/certs/node-cert\\.cert\".\\+}'" -+ ) -+ ''; -+ -+ metricProvider = { -+ system.activationScripts.cert.text = '' -+ mkdir -p /run/certs -+ cd /run/certs -+ -+ cat >ca.template <