11 , enableDigitalOcean ? true
15 , enableHetzner ? true
17 , enableKubernetes ? true
19 , enableMarathon ? true
22 , enableOpenstack ? true
23 , enableOVHCloud ? true
24 , enablePuppetDB ? true
25 , enableScaleway ? true
30 , enableZookeeper ? true
35 webUiStatic = fetchurl {
36 url = "https://github.com/prometheus/prometheus/releases/download/v${version}/prometheus-web-ui-${version}.tar.gz";
37 hash = "sha256-V13YfSEm0PMYvX13W3lahNSdDJ2oLnDr1VderLEEwyM=";
44 outputs = [ "out" "doc" "cli" ];
46 src = fetchFromGitHub {
50 hash = "sha256-7A3UJNA045l5oWLcTeEw+X/YNjeeNOvqdh/CudplLSM=";
53 vendorHash = "sha256-0TR0jFEY+ls8C9EJEhSl2vX5VVZqZ8jGWDUalOddUPM=";
55 excludedPackages = [ "documentation/prometheus-mixin" ];
58 tar -C web/ui -xzf ${webUiStatic}
62 # Enable only select service discovery to shrink binaries.
64 true # prevent bash syntax error when all plugins are disabled
65 ${lib.optionalString enableAWS "echo - github.com/prometheus/prometheus/discovery/aws"}
66 ${lib.optionalString enableAzure "echo - github.com/prometheus/prometheus/discovery/azure"}
67 ${lib.optionalString enableConsul "echo - github.com/prometheus/prometheus/discovery/consul"}
68 ${lib.optionalString enableDigitalOcean "echo - github.com/prometheus/prometheus/discovery/digitalocean"}
69 ${lib.optionalString enableDNS "echo - github.com/prometheus/prometheus/discovery/dns"}
70 ${lib.optionalString enableEureka "echo - github.com/prometheus/prometheus/discovery/eureka"}
71 ${lib.optionalString enableGCE "echo - github.com/prometheus/prometheus/discovery/gce"}
72 ${lib.optionalString enableHetzner "echo - github.com/prometheus/prometheus/discovery/hetzner"}
73 ${lib.optionalString enableIONOS "echo - github.com/prometheus/prometheus/discovery/ionos"}
74 ${lib.optionalString enableKubernetes "echo - github.com/prometheus/prometheus/discovery/kubernetes"}
75 ${lib.optionalString enableLinode "echo - github.com/prometheus/prometheus/discovery/linode"}
76 ${lib.optionalString enableMarathon "echo - github.com/prometheus/prometheus/discovery/marathon"}
77 ${lib.optionalString enableMoby "echo - github.com/prometheus/prometheus/discovery/moby"}
78 ${lib.optionalString enableNomad "echo - github.com/prometheus/prometheus/discovery/nomad"}
79 ${lib.optionalString enableOpenstack "echo - github.com/prometheus/prometheus/discovery/openstack"}
80 ${lib.optionalString enableOVHCloud "echo - github.com/prometheus/prometheus/discovery/ovhcloud"}
81 ${lib.optionalString enablePuppetDB "echo - github.com/prometheus/prometheus/discovery/puppetdb"}
82 ${lib.optionalString enableScaleway "echo - github.com/prometheus/prometheus/discovery/scaleway"}
83 ${lib.optionalString enableTriton "echo - github.com/prometheus/prometheus/discovery/triton"}
84 ${lib.optionalString enableUyuni "echo - github.com/prometheus/prometheus/discovery/uyuni"}
85 ${lib.optionalString enableVultr "echo - github.com/prometheus/prometheus/discovery/vultr"}
86 ${lib.optionalString enableXDS "echo - github.com/prometheus/prometheus/discovery/xds"}
87 ${lib.optionalString enableZookeeper "echo - github.com/prometheus/prometheus/discovery/zookeeper"}
92 if [[ -d vendor ]]; then GOARCH= make -o assets assets-compress plugins; fi
95 tags = [ "builtinassets" ];
99 t = "github.com/prometheus/common/version";
104 "-X ${t}.Version=${version}"
105 "-X ${t}.Revision=unknown"
106 "-X ${t}.Branch=unknown"
107 "-X ${t}.BuildUser=nix@nixpkgs"
108 "-X ${t}.BuildDate=unknown"
109 "-X ${t}.GoVersion=${lib.getVersion go}"
113 mkdir -p "$out/share/doc/prometheus" "$out/etc/prometheus"
114 cp -a $src/documentation/* $out/share/doc/prometheus
115 cp -a $src/console_libraries $src/consoles $out/etc/prometheus
119 moveToOutput bin/promtool $cli
122 # https://hydra.nixos.org/build/130673870/nixlog/1
123 # Test mock data uses 64 bit data without an explicit (u)int64
124 doCheck = !(stdenv.isDarwin || stdenv.hostPlatform.parsed.cpu.bits < 64);
126 passthru.tests = { inherit (nixosTests) prometheus; };
129 description = "Service monitoring system and time series database";
130 homepage = "https://prometheus.io";
131 license = licenses.asl20;
132 maintainers = with maintainers; [ fpletz willibutz Frostman ];