prometheus: use finalAttrs to make the version and webui overridable (#402499)

authored by Franz Pletz and committed by GitHub 1bc9d970 a2001229

+11 -13
+11 -13
pkgs/by-name/pr/prometheus/package.nix
··· 31 enableZookeeper ? true, 32 }: 33 34 - let 35 - version = "3.1.0"; 36 - webUiStatic = fetchurl { 37 - url = "https://github.com/prometheus/prometheus/releases/download/v${version}/prometheus-web-ui-${version}.tar.gz"; 38 - hash = "sha256-05DaaDIFtADnkLFqdHe5eUvo6LRz6BduMvGVmzOeurM="; 39 - }; 40 - in 41 - buildGoModule rec { 42 pname = "prometheus"; 43 - inherit version; 44 45 outputs = [ 46 "out" ··· 51 src = fetchFromGitHub { 52 owner = "prometheus"; 53 repo = "prometheus"; 54 - tag = "v${version}"; 55 hash = "sha256-Q3f0L6cRVQRL1AHgUI3VNbMG9eTfcApbXfSjOTHr7Go="; 56 }; 57 58 vendorHash = "sha256-vQwBnSxoyIYTeWLk3GD9pKDuUjjsMfwPptgyVnzcTok="; 59 60 excludedPackages = [ 61 "documentation/prometheus-mixin" ··· 63 ]; 64 65 postPatch = '' 66 - tar -C web/ui -xzf ${webUiStatic} 67 68 patchShebangs scripts 69 ··· 109 [ 110 "-s" 111 "-w" 112 - "-X ${t}.Version=${version}" 113 "-X ${t}.Revision=unknown" 114 "-X ${t}.Branch=unknown" 115 "-X ${t}.BuildUser=nix@nixpkgs" ··· 142 Frostman 143 ]; 144 }; 145 - }
··· 31 enableZookeeper ? true, 32 }: 33 34 + buildGoModule (finalAttrs: { 35 pname = "prometheus"; 36 + version = "3.1.0"; 37 38 outputs = [ 39 "out" ··· 44 src = fetchFromGitHub { 45 owner = "prometheus"; 46 repo = "prometheus"; 47 + tag = "v${finalAttrs.version}"; 48 hash = "sha256-Q3f0L6cRVQRL1AHgUI3VNbMG9eTfcApbXfSjOTHr7Go="; 49 }; 50 51 vendorHash = "sha256-vQwBnSxoyIYTeWLk3GD9pKDuUjjsMfwPptgyVnzcTok="; 52 + 53 + webUiStatic = fetchurl { 54 + url = "https://github.com/prometheus/prometheus/releases/download/v${finalAttrs.version}/prometheus-web-ui-${finalAttrs.version}.tar.gz"; 55 + hash = "sha256-05DaaDIFtADnkLFqdHe5eUvo6LRz6BduMvGVmzOeurM="; 56 + }; 57 58 excludedPackages = [ 59 "documentation/prometheus-mixin" ··· 61 ]; 62 63 postPatch = '' 64 + tar -C web/ui -xzf ${finalAttrs.webUiStatic} 65 66 patchShebangs scripts 67 ··· 107 [ 108 "-s" 109 "-w" 110 + "-X ${t}.Version=${finalAttrs.version}" 111 "-X ${t}.Revision=unknown" 112 "-X ${t}.Branch=unknown" 113 "-X ${t}.BuildUser=nix@nixpkgs" ··· 140 Frostman 141 ]; 142 }; 143 + })