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 31 enableZookeeper ? true, 32 32 }: 33 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 { 34 + buildGoModule (finalAttrs: { 42 35 pname = "prometheus"; 43 - inherit version; 36 + version = "3.1.0"; 44 37 45 38 outputs = [ 46 39 "out" ··· 51 44 src = fetchFromGitHub { 52 45 owner = "prometheus"; 53 46 repo = "prometheus"; 54 - tag = "v${version}"; 47 + tag = "v${finalAttrs.version}"; 55 48 hash = "sha256-Q3f0L6cRVQRL1AHgUI3VNbMG9eTfcApbXfSjOTHr7Go="; 56 49 }; 57 50 58 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 + }; 59 57 60 58 excludedPackages = [ 61 59 "documentation/prometheus-mixin" ··· 63 61 ]; 64 62 65 63 postPatch = '' 66 - tar -C web/ui -xzf ${webUiStatic} 64 + tar -C web/ui -xzf ${finalAttrs.webUiStatic} 67 65 68 66 patchShebangs scripts 69 67 ··· 109 107 [ 110 108 "-s" 111 109 "-w" 112 - "-X ${t}.Version=${version}" 110 + "-X ${t}.Version=${finalAttrs.version}" 113 111 "-X ${t}.Revision=unknown" 114 112 "-X ${t}.Branch=unknown" 115 113 "-X ${t}.BuildUser=nix@nixpkgs" ··· 142 140 Frostman 143 141 ]; 144 142 }; 145 - } 143 + })