prometheus: use finalAttrs to make the version and webui overridable (#402499)
This commit is contained in:
@@ -31,16 +31,9 @@
|
||||
enableZookeeper ? true,
|
||||
}:
|
||||
|
||||
let
|
||||
version = "3.1.0";
|
||||
webUiStatic = fetchurl {
|
||||
url = "https://github.com/prometheus/prometheus/releases/download/v${version}/prometheus-web-ui-${version}.tar.gz";
|
||||
hash = "sha256-05DaaDIFtADnkLFqdHe5eUvo6LRz6BduMvGVmzOeurM=";
|
||||
};
|
||||
in
|
||||
buildGoModule rec {
|
||||
buildGoModule (finalAttrs: {
|
||||
pname = "prometheus";
|
||||
inherit version;
|
||||
version = "3.1.0";
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
@@ -51,19 +44,24 @@ buildGoModule rec {
|
||||
src = fetchFromGitHub {
|
||||
owner = "prometheus";
|
||||
repo = "prometheus";
|
||||
tag = "v${version}";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-Q3f0L6cRVQRL1AHgUI3VNbMG9eTfcApbXfSjOTHr7Go=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-vQwBnSxoyIYTeWLk3GD9pKDuUjjsMfwPptgyVnzcTok=";
|
||||
|
||||
webUiStatic = fetchurl {
|
||||
url = "https://github.com/prometheus/prometheus/releases/download/v${finalAttrs.version}/prometheus-web-ui-${finalAttrs.version}.tar.gz";
|
||||
hash = "sha256-05DaaDIFtADnkLFqdHe5eUvo6LRz6BduMvGVmzOeurM=";
|
||||
};
|
||||
|
||||
excludedPackages = [
|
||||
"documentation/prometheus-mixin"
|
||||
"web/ui/mantine-ui/src/promql/tools"
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
tar -C web/ui -xzf ${webUiStatic}
|
||||
tar -C web/ui -xzf ${finalAttrs.webUiStatic}
|
||||
|
||||
patchShebangs scripts
|
||||
|
||||
@@ -109,7 +107,7 @@ buildGoModule rec {
|
||||
[
|
||||
"-s"
|
||||
"-w"
|
||||
"-X ${t}.Version=${version}"
|
||||
"-X ${t}.Version=${finalAttrs.version}"
|
||||
"-X ${t}.Revision=unknown"
|
||||
"-X ${t}.Branch=unknown"
|
||||
"-X ${t}.BuildUser=nix@nixpkgs"
|
||||
@@ -142,4 +140,4 @@ buildGoModule rec {
|
||||
Frostman
|
||||
];
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user