lol

perses: init at 0.51.0-rc.0 (#409779)

authored by

Martin Weinelt and committed by
GitHub
5b0eafc9 355feeb4

+257
+130
pkgs/by-name/pe/perses/package.nix
··· 1 + { 2 + lib, 3 + fetchFromGitHub, 4 + fetchNpmDeps, 5 + fetchurl, 6 + buildGoModule, 7 + npmHooks, 8 + nodejs, 9 + turbo, 10 + linkFarm, 11 + }: 12 + 13 + let 14 + # Create a plugins-archive to be embedded into the perses package similar to 15 + # what $src/scripts/install_plugin.go does 16 + pluginsArchive = linkFarm "perses-plugin-archive" ( 17 + lib.mapAttrsToList (name: plugin: { 18 + name = "${name}-${plugin.version}.tar.gz"; 19 + path = fetchurl { 20 + inherit (plugin) url hash; 21 + }; 22 + }) (import ./plugins.nix) 23 + ); 24 + 25 + in 26 + buildGoModule (finalAttrs: { 27 + pname = "perses"; 28 + version = "0.51.0-rc.0"; 29 + 30 + src = fetchFromGitHub { 31 + owner = "perses"; 32 + repo = "perses"; 33 + tag = "v${finalAttrs.version}"; 34 + hash = "sha256-ts/GqBASja+IbZAKWMtExeVyFs6Q76iI9o6AKWZlp9Y="; 35 + }; 36 + 37 + outputs = [ 38 + "out" 39 + "cue" 40 + ]; 41 + 42 + nativeBuildInputs = [ 43 + npmHooks.npmConfigHook 44 + nodejs 45 + turbo 46 + ]; 47 + 48 + npmDeps = fetchNpmDeps { 49 + inherit (finalAttrs) version src; 50 + pname = "${finalAttrs.pname}-ui"; 51 + sourceRoot = "${finalAttrs.src.name}/${finalAttrs.npmRoot}"; 52 + hash = "sha256-a3bkk8IDfxi5nbRqu4WgYZ9bDr5my11HV4a72THclNw="; 53 + }; 54 + 55 + npmRoot = "ui"; 56 + 57 + overrideModAttrs = oldAttrs: { 58 + nativeBuildInputs = lib.remove npmHooks.npmConfigHook oldAttrs.nativeBuildInputs; 59 + preBuild = null; 60 + }; 61 + 62 + vendorHash = "sha256-DJAWmeuRPA2pII2RQZNF37n/QNmw2wDUtDpATMqkSJ8="; 63 + 64 + ldflags = [ 65 + "-s" 66 + "-w" 67 + "-X github.com/prometheus/common/version.Version=${finalAttrs.version}" 68 + "-X github.com/prometheus/common/version.Revision=${finalAttrs.src.tag}" 69 + "-X github.com/prometheus/common/version.Branch=${finalAttrs.src.tag}" 70 + "-X github.com/prometheus/common/version.Date=1970-01-01" 71 + "-X github.com/perses/perses/pkg/model/api/config.DefaultPluginPath=/run/perses/plugins" 72 + "-X github.com/perses/perses/pkg/model/api/config.DefaultArchivePluginPath=${pluginsArchive}" 73 + ]; 74 + 75 + subPackages = [ 76 + "cmd/percli" 77 + "cmd/perses" 78 + ]; 79 + 80 + patches = [ 81 + # This patch allows to override the default config paths using linker constants above 82 + # See https://github.com/perses/perses/issues/2947 83 + ./plugin-path-config.patch 84 + ]; 85 + 86 + prePatch = '' 87 + patchShebangs . 88 + ''; 89 + 90 + preBuild = '' 91 + pushd "$npmRoot" 92 + npm run build 93 + popd 94 + 95 + go generate ./internal/api 96 + 97 + ./scripts/compress_assets.sh 98 + ''; 99 + 100 + postInstall = '' 101 + cp -r cue "$cue" 102 + ''; 103 + 104 + doInstallCheck = true; 105 + installCheckPhase = '' 106 + runHook preInstallCheck 107 + 108 + $out/bin/percli help > /dev/null 109 + 110 + $out/bin/perses --help 2> /dev/null 111 + 112 + runHook postInstallCheck 113 + ''; 114 + 115 + passthru = { 116 + updateScript = ./update.sh; 117 + 118 + inherit pluginsArchive; 119 + }; 120 + 121 + meta = { 122 + description = "The CNCF sandbox for observability visualisation"; 123 + homepage = "https://perses.dev/"; 124 + changelog = "https://github.com/perses/perses/releases/tag/v${finalAttrs.version}"; 125 + license = lib.licenses.asl20; 126 + maintainers = with lib.maintainers; [ fooker ]; 127 + platforms = lib.platforms.unix; 128 + mainProgram = "perses"; 129 + }; 130 + })
+13
pkgs/by-name/pe/perses/plugin-path-config.patch
··· 1 + diff --git a/pkg/model/api/config/plugin.go b/pkg/model/api/config/plugin.go 2 + index 9ece1ced..603c6b0b 100644 3 + --- a/pkg/model/api/config/plugin.go 4 + +++ b/pkg/model/api/config/plugin.go 5 + @@ -17,7 +17,7 @@ import ( 6 + "os" 7 + ) 8 + 9 + -const ( 10 + +var ( 11 + DefaultPluginPath = "plugins" 12 + DefaultPluginPathInContainer = "/etc/perses/plugins" 13 + DefaultArchivePluginPath = "plugins-archive"
+79
pkgs/by-name/pe/perses/plugins.nix
··· 1 + # This file has been autogenerated by update.sh 2 + # Do not edit this file manually. 3 + { 4 + "BarChart" = { 5 + version = "0.6.1"; 6 + url = "https://github.com/perses/plugins/releases/download/barchart/v0.6.1/BarChart-0.6.1.tar.gz"; 7 + hash = "sha256-A5p46sZfzzS6ss3wNJFTyI8N4YAPVev5+rmakbM1n1g="; 8 + }; 9 + "GaugeChart" = { 10 + version = "0.6.0"; 11 + url = "https://github.com/perses/plugins/releases/download/gaugechart/v0.6.0/GaugeChart-0.6.0.tar.gz"; 12 + hash = "sha256-Ug/GzdlRZjIbio72F/fWquIkg7xqTLf5y1gW9IoXl7g="; 13 + }; 14 + "Markdown" = { 15 + version = "0.7.0"; 16 + url = "https://github.com/perses/plugins/releases/download/markdown/v0.7.0/Markdown-0.7.0.tar.gz"; 17 + hash = "sha256-KGlmEMUirjbwvirIT5Alt6Rsxk/2TIxspa2ikG6AJ7Y="; 18 + }; 19 + "PieChart" = { 20 + version = "0.6.0"; 21 + url = "https://github.com/perses/plugins/releases/download/piechart/v0.6.0/PieChart-0.6.0.tar.gz"; 22 + hash = "sha256-AseYkh7Vl1TQJbOPwuMmCvKQls79fIQHQb7Gq6yZIUE="; 23 + }; 24 + "Prometheus" = { 25 + version = "0.51.0-beta.2"; 26 + url = "https://github.com/perses/plugins/releases/download/prometheus/v0.51.0-beta.2/Prometheus-0.51.0-beta.2.tar.gz"; 27 + hash = "sha256-PUsaZyycDDNaIIhBPIjxnucij9yYZP2TxsX2GvqUTVo="; 28 + }; 29 + "ScatterChart" = { 30 + version = "0.6.0"; 31 + url = "https://github.com/perses/plugins/releases/download/scatterchart/v0.6.0/ScatterChart-0.6.0.tar.gz"; 32 + hash = "sha256-M1g/EWL5P/jSeTYMGTShuD+AavqK9vJkLeOjYX+dP3c="; 33 + }; 34 + "StatChart" = { 35 + version = "0.6.0"; 36 + url = "https://github.com/perses/plugins/releases/download/statchart/v0.6.0/StatChart-0.6.0.tar.gz"; 37 + hash = "sha256-lxT2Zimo62i6dLR01uuEgcYs55LLlqyuXIv0DGZlAaM="; 38 + }; 39 + "StaticListVariable" = { 40 + version = "0.3.0"; 41 + url = "https://github.com/perses/plugins/releases/download/staticlistvariable/v0.3.0/StaticListVariable-0.3.0.tar.gz"; 42 + hash = "sha256-1PmMDuWIq7ALV8DqqL+XJilkfGV2qXVOy9ZMTQrzRq8="; 43 + }; 44 + "StatusHistoryChart" = { 45 + version = "0.6.0"; 46 + url = "https://github.com/perses/plugins/releases/download/statushistorychart/v0.6.0/StatusHistoryChart-0.6.0.tar.gz"; 47 + hash = "sha256-+U5IIZME3FXACIh3S725tuCdbTzlVRUrU9LFSldnMiI="; 48 + }; 49 + "Table" = { 50 + version = "0.6.0"; 51 + url = "https://github.com/perses/plugins/releases/download/table/v0.6.0/Table-0.6.0.tar.gz"; 52 + hash = "sha256-pndqD5lrwXe66GiaC+NQgFJiaSJasldpmgwrnEAFmJU="; 53 + }; 54 + "Tempo" = { 55 + version = "0.51.0-beta.2"; 56 + url = "https://github.com/perses/plugins/releases/download/tempo/v0.51.0-beta.2/Tempo-0.51.0-beta.2.tar.gz"; 57 + hash = "sha256-p1ey0we7ncsnoIcCNhlmzp3NRNrxtayTKruJCuR50gw="; 58 + }; 59 + "TimeSeriesChart" = { 60 + version = "0.6.0"; 61 + url = "https://github.com/perses/plugins/releases/download/timeserieschart/v0.6.0/TimeSeriesChart-0.6.0.tar.gz"; 62 + hash = "sha256-6inzw4W7lakhbmVDkrgA8uwI6MLiVuk1xbiy904y6Ig="; 63 + }; 64 + "TimeSeriesTable" = { 65 + version = "0.6.0"; 66 + url = "https://github.com/perses/plugins/releases/download/timeseriestable/v0.6.0/TimeSeriesTable-0.6.0.tar.gz"; 67 + hash = "sha256-bkVhkfRZXGgKZGrQ9crag92jFFiRxZaZOb/UyBTyWGM="; 68 + }; 69 + "TraceTable" = { 70 + version = "0.6.0"; 71 + url = "https://github.com/perses/plugins/releases/download/tracetable/v0.6.0/TraceTable-0.6.0.tar.gz"; 72 + hash = "sha256-u8/NW23rGX2sAyuVoL7pH1WFYOhcdMFlzE4qMvMBYgE="; 73 + }; 74 + "TracingGanttChart" = { 75 + version = "0.6.0"; 76 + url = "https://github.com/perses/plugins/releases/download/tracingganttchart/v0.6.0/TracingGanttChart-0.6.0.tar.gz"; 77 + hash = "sha256-R1U/Uq5QPVQWBe24IKovRXCsCyuUmATBcnqxRuRD+Aw="; 78 + }; 79 + }
+35
pkgs/by-name/pe/perses/update.sh
··· 1 + #!/usr/bin/env nix-shell 2 + #!nix-shell -i bash -p nix-update yq 3 + 4 + set -euo pipefail 5 + 6 + nix-update "${UPDATE_NIX_ATTR_PATH}" --version=unstable 7 + 8 + src="$(nix-build -A "${UPDATE_NIX_ATTR_PATH}".src --no-out-link)" 9 + 10 + ( 11 + echo "# This file has been autogenerated by update.sh" 12 + echo "# Do not edit this file manually." 13 + 14 + echo "{" 15 + 16 + yq -r '.[]|[.name, .version] | @tsv' < "${src}/scripts/plugin/plugin.yaml" \ 17 + | while IFS=$'\t' read -r name version; do 18 + echo " \"${name}\" = {" 19 + 20 + echo " version = \"${version}\";" 21 + 22 + url="https://github.com/perses/plugins/releases/download/${name,,}/v${version}/${name}-${version}.tar.gz" 23 + echo " url = \"${url}\";" 24 + 25 + hash="$(nix-prefetch-url "${url}" --name "${UPDATE_NIX_PNAME}-${name,,}-${version}.tar.gz")" 26 + hash="$(nix hash convert --hash-algo sha256 "${hash}")" 27 + 28 + echo " hash = \"${hash}\";" 29 + 30 + echo " };" 31 + done 32 + 33 + echo "}" 34 + ) > "$(dirname "${BASH_SOURCE[0]}")/plugins.nix" 35 +