12 enableDigitalOcean ? true,
18 enableKubernetes ? true,
20 enableMarathon ? true,
23 enableOpenstack ? true,
24 enableOVHCloud ? true,
25 enablePuppetDB ? true,
26 enableScaleway ? true,
31 enableZookeeper ? true,
36 webUiStatic = fetchurl {
37 url = "https://github.com/prometheus/prometheus/releases/download/v${version}/prometheus-web-ui-${version}.tar.gz";
38 hash = "sha256-MP7B7gVRQnspXLLNmPH8t3DYKbsQkDV9hPJYbM2rB9M=";
51 src = fetchFromGitHub {
55 hash = "sha256-dN6ckW451G45ZO7baY7H4qEf88ZDeISZwZ3uwWPZsW8=";
58 vendorHash = "sha256-c96YnWPLH/tbGRb2Zlqrl3PXSZvI+NeYTGlef6REAOw=";
61 "documentation/prometheus-mixin"
62 "web/ui/mantine-ui/src/promql/tools"
66 tar -C web/ui -xzf ${webUiStatic}
70 # Enable only select service discovery to shrink binaries.
72 true # prevent bash syntax error when all plugins are disabled
73 ${lib.optionalString enableAWS "echo - github.com/prometheus/prometheus/discovery/aws"}
74 ${lib.optionalString enableAzure "echo - github.com/prometheus/prometheus/discovery/azure"}
75 ${lib.optionalString enableConsul "echo - github.com/prometheus/prometheus/discovery/consul"}
76 ${lib.optionalString enableDigitalOcean "echo - github.com/prometheus/prometheus/discovery/digitalocean"}
77 ${lib.optionalString enableDNS "echo - github.com/prometheus/prometheus/discovery/dns"}
78 ${lib.optionalString enableEureka "echo - github.com/prometheus/prometheus/discovery/eureka"}
79 ${lib.optionalString enableGCE "echo - github.com/prometheus/prometheus/discovery/gce"}
80 ${lib.optionalString enableHetzner "echo - github.com/prometheus/prometheus/discovery/hetzner"}
81 ${lib.optionalString enableIONOS "echo - github.com/prometheus/prometheus/discovery/ionos"}
82 ${lib.optionalString enableKubernetes "echo - github.com/prometheus/prometheus/discovery/kubernetes"}
83 ${lib.optionalString enableLinode "echo - github.com/prometheus/prometheus/discovery/linode"}
84 ${lib.optionalString enableMarathon "echo - github.com/prometheus/prometheus/discovery/marathon"}
85 ${lib.optionalString enableMoby "echo - github.com/prometheus/prometheus/discovery/moby"}
86 ${lib.optionalString enableNomad "echo - github.com/prometheus/prometheus/discovery/nomad"}
87 ${lib.optionalString enableOpenstack "echo - github.com/prometheus/prometheus/discovery/openstack"}
88 ${lib.optionalString enableOVHCloud "echo - github.com/prometheus/prometheus/discovery/ovhcloud"}
89 ${lib.optionalString enablePuppetDB "echo - github.com/prometheus/prometheus/discovery/puppetdb"}
90 ${lib.optionalString enableScaleway "echo - github.com/prometheus/prometheus/discovery/scaleway"}
91 ${lib.optionalString enableTriton "echo - github.com/prometheus/prometheus/discovery/triton"}
92 ${lib.optionalString enableUyuni "echo - github.com/prometheus/prometheus/discovery/uyuni"}
93 ${lib.optionalString enableVultr "echo - github.com/prometheus/prometheus/discovery/vultr"}
94 ${lib.optionalString enableXDS "echo - github.com/prometheus/prometheus/discovery/xds"}
95 ${lib.optionalString enableZookeeper "echo - github.com/prometheus/prometheus/discovery/zookeeper"}
100 if [[ -d vendor ]]; then GOARCH= make -o assets assets-compress plugins; fi
103 tags = [ "builtinassets" ];
107 t = "github.com/prometheus/common/version";
112 "-X ${t}.Version=${version}"
113 "-X ${t}.Revision=unknown"
114 "-X ${t}.Branch=unknown"
115 "-X ${t}.BuildUser=nix@nixpkgs"
116 "-X ${t}.BuildDate=unknown"
117 "-X ${t}.GoVersion=${lib.getVersion go}"
121 mkdir -p "$out/share/doc/prometheus" "$out/etc/prometheus"
122 cp -a $src/documentation/* $out/share/doc/prometheus
126 moveToOutput bin/promtool $cli
129 # https://hydra.nixos.org/build/130673870/nixlog/1
130 # Test mock data uses 64 bit data without an explicit (u)int64
131 doCheck = !(stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.parsed.cpu.bits < 64);
133 passthru.tests = { inherit (nixosTests) prometheus; };
136 description = "Service monitoring system and time series database";
137 homepage = "https://prometheus.io";
138 license = licenses.asl20;
139 maintainers = with maintainers; [