From 2564ae1eed972122d5f42ad1f0b4ad5086c4323b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Fri, 10 Mar 2023 11:29:50 +0100 Subject: [PATCH 1/4] prometheus: 2.41.0 -> 2.42.0 --- pkgs/servers/monitoring/prometheus/default.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/servers/monitoring/prometheus/default.nix b/pkgs/servers/monitoring/prometheus/default.nix index ade935f16d04..f2c5d648c679 100644 --- a/pkgs/servers/monitoring/prometheus/default.nix +++ b/pkgs/servers/monitoring/prometheus/default.nix @@ -31,10 +31,10 @@ }: let - version = "2.41.0"; + version = "2.42.0"; webUiStatic = fetchurl { url = "https://github.com/prometheus/prometheus/releases/download/v${version}/prometheus-web-ui-${version}.tar.gz"; - sha256 = "sha256-0EFeAuhQUu+4TCoHsWHTbWTGJLjS37POacP1K42sGqI="; + sha256 = "sha256-QOnt8YZkq+/cmoaI8ZOrVbgVh5MnaKpDBVtPTckl4+A="; }; in buildGoModule rec { @@ -42,13 +42,13 @@ buildGoModule rec { inherit version; src = fetchFromGitHub { - rev = "v${version}"; owner = "prometheus"; repo = "prometheus"; - sha256 = "sha256-J3KDN02m639bUGrnUrqeCLferrqIHaJ2VEBjIqfm/GY="; + rev = "v${version}"; + sha256 = "sha256-UwowidKKn3fp2z/MSbwESpl2E4IIioEC0oV1QRE7ViQ="; }; - vendorSha256 = "sha256-4Of1euBp5Lka6Bb2UJYUQuRa7t2/B1HaXCWSOqCASYw="; + vendorSha256 = "sha256-wUniz7E9l/5ldgPHo+wZkKaZuAH5kvjT0VDl4qkcoNs="; excludedPackages = [ "documentation/prometheus-mixin" ]; From da2f281453eaf30e813948f384a5600896e044ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Fri, 10 Mar 2023 11:45:45 +0100 Subject: [PATCH 2/4] prometheus: split doc and cli into extra outputs --- nixos/modules/services/monitoring/prometheus/default.nix | 2 +- pkgs/servers/monitoring/prometheus/default.nix | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/monitoring/prometheus/default.nix b/nixos/modules/services/monitoring/prometheus/default.nix index f516b75ab10f..c2b3fa2e4c4f 100644 --- a/nixos/modules/services/monitoring/prometheus/default.nix +++ b/nixos/modules/services/monitoring/prometheus/default.nix @@ -31,7 +31,7 @@ let if checkConfigEnabled then pkgs.runCommandLocal "${name}-${replaceStrings [" "] [""] what}-checked" - { buildInputs = [ cfg.package ]; } '' + { buildInputs = [ cfg.package.cli ]; } '' ln -s ${file} $out promtool ${what} $out '' else file; diff --git a/pkgs/servers/monitoring/prometheus/default.nix b/pkgs/servers/monitoring/prometheus/default.nix index f2c5d648c679..3701afc5139b 100644 --- a/pkgs/servers/monitoring/prometheus/default.nix +++ b/pkgs/servers/monitoring/prometheus/default.nix @@ -41,6 +41,8 @@ buildGoModule rec { pname = "prometheus"; inherit version; + outputs = [ "out" "doc" "cli" ]; + src = fetchFromGitHub { owner = "prometheus"; repo = "prometheus"; @@ -132,6 +134,10 @@ buildGoModule rec { cp -a $src/console_libraries $src/consoles $out/etc/prometheus ''; + postInstall = '' + moveToOutput bin/promtool $cli + ''; + doCheck = !stdenv.isDarwin; # https://hydra.nixos.org/build/130673870/nixlog/1 passthru.tests = { inherit (nixosTests) prometheus; }; From 24d2e1f8e3dad35998edfa8a732a7f552f5c0a1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Fri, 10 Mar 2023 11:46:37 +0100 Subject: [PATCH 3/4] prometheus: format, add stripping options, remove redundant meta.platforms, cleanup maintainers --- .../servers/monitoring/prometheus/default.nix | 73 +++++++------------ 1 file changed, 26 insertions(+), 47 deletions(-) diff --git a/pkgs/servers/monitoring/prometheus/default.nix b/pkgs/servers/monitoring/prometheus/default.nix index 3701afc5139b..4a40a45450b3 100644 --- a/pkgs/servers/monitoring/prometheus/default.nix +++ b/pkgs/servers/monitoring/prometheus/default.nix @@ -61,51 +61,29 @@ buildGoModule rec { # Enable only select service discovery to shrink binaries. ( - true # prevent bash syntax error when all plugins are disabled - ${lib.optionalString (enableAWS) - "echo - github.com/prometheus/prometheus/discovery/aws"} - ${lib.optionalString (enableAzure) - "echo - github.com/prometheus/prometheus/discovery/azure"} - ${lib.optionalString (enableConsul) - "echo - github.com/prometheus/prometheus/discovery/consul"} - ${lib.optionalString (enableDigitalOcean) - "echo - github.com/prometheus/prometheus/discovery/digitalocean"} - ${lib.optionalString (enableDNS) - "echo - github.com/prometheus/prometheus/discovery/dns"} - ${lib.optionalString (enableEureka) - "echo - github.com/prometheus/prometheus/discovery/eureka"} - ${lib.optionalString (enableGCE) - "echo - github.com/prometheus/prometheus/discovery/gce"} - ${lib.optionalString (enableHetzner) - "echo - github.com/prometheus/prometheus/discovery/hetzner"} - ${lib.optionalString (enableIONOS) - "echo - github.com/prometheus/prometheus/discovery/ionos"} - ${lib.optionalString (enableKubernetes) - "echo - github.com/prometheus/prometheus/discovery/kubernetes"} - ${lib.optionalString (enableLinode) - "echo - github.com/prometheus/prometheus/discovery/linode"} - ${lib.optionalString (enableMarathon) - "echo - github.com/prometheus/prometheus/discovery/marathon"} - ${lib.optionalString (enableMoby) - "echo - github.com/prometheus/prometheus/discovery/moby"} - ${lib.optionalString (enableNomad) - "echo - github.com/prometheus/prometheus/discovery/nomad"} - ${lib.optionalString (enableOpenstack) - "echo - github.com/prometheus/prometheus/discovery/openstack"} - ${lib.optionalString (enablePuppetDB) - "echo - github.com/prometheus/prometheus/discovery/puppetdb"} - ${lib.optionalString (enableScaleway) - "echo - github.com/prometheus/prometheus/discovery/scaleway"} - ${lib.optionalString (enableTriton) - "echo - github.com/prometheus/prometheus/discovery/triton"} - ${lib.optionalString (enableUyuni) - "echo - github.com/prometheus/prometheus/discovery/uyuni"} - ${lib.optionalString (enableVultr) - "echo - github.com/prometheus/prometheus/discovery/vultr"} - ${lib.optionalString (enableXDS) - "echo - github.com/prometheus/prometheus/discovery/xds"} - ${lib.optionalString (enableZookeeper) - "echo - github.com/prometheus/prometheus/discovery/zookeeper"} + true # prevent bash syntax error when all plugins are disabled + ${lib.optionalString enableAWS "echo - github.com/prometheus/prometheus/discovery/aws"} + ${lib.optionalString enableAzure "echo - github.com/prometheus/prometheus/discovery/azure"} + ${lib.optionalString enableConsul "echo - github.com/prometheus/prometheus/discovery/consul"} + ${lib.optionalString enableDigitalOcean "echo - github.com/prometheus/prometheus/discovery/digitalocean"} + ${lib.optionalString enableDNS "echo - github.com/prometheus/prometheus/discovery/dns"} + ${lib.optionalString enableEureka "echo - github.com/prometheus/prometheus/discovery/eureka"} + ${lib.optionalString enableGCE "echo - github.com/prometheus/prometheus/discovery/gce"} + ${lib.optionalString enableHetzner "echo - github.com/prometheus/prometheus/discovery/hetzner"} + ${lib.optionalString enableIONOS "echo - github.com/prometheus/prometheus/discovery/ionos"} + ${lib.optionalString enableKubernetes "echo - github.com/prometheus/prometheus/discovery/kubernetes"} + ${lib.optionalString enableLinode "echo - github.com/prometheus/prometheus/discovery/linode"} + ${lib.optionalString enableMarathon "echo - github.com/prometheus/prometheus/discovery/marathon"} + ${lib.optionalString enableMoby "echo - github.com/prometheus/prometheus/discovery/moby"} + ${lib.optionalString enableNomad "echo - github.com/prometheus/prometheus/discovery/nomad"} + ${lib.optionalString enableOpenstack "echo - github.com/prometheus/prometheus/discovery/openstack"} + ${lib.optionalString enablePuppetDB "echo - github.com/prometheus/prometheus/discovery/puppetdb"} + ${lib.optionalString enableScaleway "echo - github.com/prometheus/prometheus/discovery/scaleway"} + ${lib.optionalString enableTriton "echo - github.com/prometheus/prometheus/discovery/triton"} + ${lib.optionalString enableUyuni "echo - github.com/prometheus/prometheus/discovery/uyuni"} + ${lib.optionalString enableVultr "echo - github.com/prometheus/prometheus/discovery/vultr"} + ${lib.optionalString enableXDS "echo - github.com/prometheus/prometheus/discovery/xds"} + ${lib.optionalString enableZookeeper "echo - github.com/prometheus/prometheus/discovery/zookeeper"} ) > plugins.yml ''; @@ -120,6 +98,8 @@ buildGoModule rec { t = "github.com/prometheus/common/version"; in [ + "-s" + "-w" "-X ${t}.Version=${version}" "-X ${t}.Revision=unknown" "-X ${t}.Branch=unknown" @@ -146,7 +126,6 @@ buildGoModule rec { description = "Service monitoring system and time series database"; homepage = "https://prometheus.io"; license = licenses.asl20; - maintainers = with maintainers; [ benley fpletz globin willibutz Frostman ]; - platforms = platforms.unix; + maintainers = with maintainers; [ fpletz willibutz Frostman ]; }; } From ddd7321df044a4eee465baf792d64d5f6427e242 Mon Sep 17 00:00:00 2001 From: Franz Pletz Date: Tue, 14 Mar 2023 00:45:03 +0100 Subject: [PATCH 4/4] prometheus: enable OVHCloud plugin --- pkgs/servers/monitoring/prometheus/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/servers/monitoring/prometheus/default.nix b/pkgs/servers/monitoring/prometheus/default.nix index 4a40a45450b3..1724c0f53faa 100644 --- a/pkgs/servers/monitoring/prometheus/default.nix +++ b/pkgs/servers/monitoring/prometheus/default.nix @@ -21,6 +21,7 @@ , enableMoby ? true , enableNomad ? true , enableOpenstack ? true +, enableOVHCloud ? true , enablePuppetDB ? true , enableScaleway ? true , enableTriton ? true @@ -77,6 +78,7 @@ buildGoModule rec { ${lib.optionalString enableMoby "echo - github.com/prometheus/prometheus/discovery/moby"} ${lib.optionalString enableNomad "echo - github.com/prometheus/prometheus/discovery/nomad"} ${lib.optionalString enableOpenstack "echo - github.com/prometheus/prometheus/discovery/openstack"} + ${lib.optionalString enableOVHCloud "echo - github.com/prometheus/prometheus/discovery/ovhcloud"} ${lib.optionalString enablePuppetDB "echo - github.com/prometheus/prometheus/discovery/puppetdb"} ${lib.optionalString enableScaleway "echo - github.com/prometheus/prometheus/discovery/scaleway"} ${lib.optionalString enableTriton "echo - github.com/prometheus/prometheus/discovery/triton"}