mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
perses: init at 0.51.0-rc.0
This commit is contained in:
parent
ea131632dc
commit
9f8d45af8c
4 changed files with 257 additions and 0 deletions
130
pkgs/by-name/pe/perses/package.nix
Normal file
130
pkgs/by-name/pe/perses/package.nix
Normal file
|
@ -0,0 +1,130 @@
|
|||
{
|
||||
lib,
|
||||
fetchFromGitHub,
|
||||
fetchNpmDeps,
|
||||
fetchurl,
|
||||
buildGoModule,
|
||||
npmHooks,
|
||||
nodejs,
|
||||
turbo,
|
||||
linkFarm,
|
||||
}:
|
||||
|
||||
let
|
||||
# Create a plugins-archive to be embedded into the perses package similar to
|
||||
# what $src/scripts/install_plugin.go does
|
||||
pluginsArchive = linkFarm "perses-plugin-archive" (
|
||||
lib.mapAttrsToList (name: plugin: {
|
||||
name = "${name}-${plugin.version}.tar.gz";
|
||||
path = fetchurl {
|
||||
inherit (plugin) url hash;
|
||||
};
|
||||
}) (import ./plugins.nix)
|
||||
);
|
||||
|
||||
in
|
||||
buildGoModule (finalAttrs: {
|
||||
pname = "perses";
|
||||
version = "0.51.0-rc.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "perses";
|
||||
repo = "perses";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-ts/GqBASja+IbZAKWMtExeVyFs6Q76iI9o6AKWZlp9Y=";
|
||||
};
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
"cue"
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
npmHooks.npmConfigHook
|
||||
nodejs
|
||||
turbo
|
||||
];
|
||||
|
||||
npmDeps = fetchNpmDeps {
|
||||
inherit (finalAttrs) version src;
|
||||
pname = "${finalAttrs.pname}-ui";
|
||||
sourceRoot = "${finalAttrs.src.name}/${finalAttrs.npmRoot}";
|
||||
hash = "sha256-a3bkk8IDfxi5nbRqu4WgYZ9bDr5my11HV4a72THclNw=";
|
||||
};
|
||||
|
||||
npmRoot = "ui";
|
||||
|
||||
overrideModAttrs = oldAttrs: {
|
||||
nativeBuildInputs = lib.remove npmHooks.npmConfigHook oldAttrs.nativeBuildInputs;
|
||||
preBuild = null;
|
||||
};
|
||||
|
||||
vendorHash = "sha256-DJAWmeuRPA2pII2RQZNF37n/QNmw2wDUtDpATMqkSJ8=";
|
||||
|
||||
ldflags = [
|
||||
"-s"
|
||||
"-w"
|
||||
"-X github.com/prometheus/common/version.Version=${finalAttrs.version}"
|
||||
"-X github.com/prometheus/common/version.Revision=${finalAttrs.src.tag}"
|
||||
"-X github.com/prometheus/common/version.Branch=${finalAttrs.src.tag}"
|
||||
"-X github.com/prometheus/common/version.Date=1970-01-01"
|
||||
"-X github.com/perses/perses/pkg/model/api/config.DefaultPluginPath=/run/perses/plugins"
|
||||
"-X github.com/perses/perses/pkg/model/api/config.DefaultArchivePluginPath=${pluginsArchive}"
|
||||
];
|
||||
|
||||
subPackages = [
|
||||
"cmd/percli"
|
||||
"cmd/perses"
|
||||
];
|
||||
|
||||
patches = [
|
||||
# This patch allows to override the default config paths using linker constants above
|
||||
# See https://github.com/perses/perses/issues/2947
|
||||
./plugin-path-config.patch
|
||||
];
|
||||
|
||||
prePatch = ''
|
||||
patchShebangs .
|
||||
'';
|
||||
|
||||
preBuild = ''
|
||||
pushd "$npmRoot"
|
||||
npm run build
|
||||
popd
|
||||
|
||||
go generate ./internal/api
|
||||
|
||||
./scripts/compress_assets.sh
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
cp -r cue "$cue"
|
||||
'';
|
||||
|
||||
doInstallCheck = true;
|
||||
installCheckPhase = ''
|
||||
runHook preInstallCheck
|
||||
|
||||
$out/bin/percli help > /dev/null
|
||||
|
||||
$out/bin/perses --help 2> /dev/null
|
||||
|
||||
runHook postInstallCheck
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
updateScript = ./update.sh;
|
||||
|
||||
inherit pluginsArchive;
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "The CNCF sandbox for observability visualisation";
|
||||
homepage = "https://perses.dev/";
|
||||
changelog = "https://github.com/perses/perses/releases/tag/v${finalAttrs.version}";
|
||||
license = lib.licenses.asl20;
|
||||
maintainers = with lib.maintainers; [ fooker ];
|
||||
platforms = lib.platforms.unix;
|
||||
mainProgram = "perses";
|
||||
};
|
||||
})
|
13
pkgs/by-name/pe/perses/plugin-path-config.patch
Normal file
13
pkgs/by-name/pe/perses/plugin-path-config.patch
Normal file
|
@ -0,0 +1,13 @@
|
|||
diff --git a/pkg/model/api/config/plugin.go b/pkg/model/api/config/plugin.go
|
||||
index 9ece1ced..603c6b0b 100644
|
||||
--- a/pkg/model/api/config/plugin.go
|
||||
+++ b/pkg/model/api/config/plugin.go
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
"os"
|
||||
)
|
||||
|
||||
-const (
|
||||
+var (
|
||||
DefaultPluginPath = "plugins"
|
||||
DefaultPluginPathInContainer = "/etc/perses/plugins"
|
||||
DefaultArchivePluginPath = "plugins-archive"
|
79
pkgs/by-name/pe/perses/plugins.nix
Normal file
79
pkgs/by-name/pe/perses/plugins.nix
Normal file
|
@ -0,0 +1,79 @@
|
|||
# This file has been autogenerated by update.sh
|
||||
# Do not edit this file manually.
|
||||
{
|
||||
"BarChart" = {
|
||||
version = "0.6.1";
|
||||
url = "https://github.com/perses/plugins/releases/download/barchart/v0.6.1/BarChart-0.6.1.tar.gz";
|
||||
hash = "sha256-A5p46sZfzzS6ss3wNJFTyI8N4YAPVev5+rmakbM1n1g=";
|
||||
};
|
||||
"GaugeChart" = {
|
||||
version = "0.6.0";
|
||||
url = "https://github.com/perses/plugins/releases/download/gaugechart/v0.6.0/GaugeChart-0.6.0.tar.gz";
|
||||
hash = "sha256-Ug/GzdlRZjIbio72F/fWquIkg7xqTLf5y1gW9IoXl7g=";
|
||||
};
|
||||
"Markdown" = {
|
||||
version = "0.7.0";
|
||||
url = "https://github.com/perses/plugins/releases/download/markdown/v0.7.0/Markdown-0.7.0.tar.gz";
|
||||
hash = "sha256-KGlmEMUirjbwvirIT5Alt6Rsxk/2TIxspa2ikG6AJ7Y=";
|
||||
};
|
||||
"PieChart" = {
|
||||
version = "0.6.0";
|
||||
url = "https://github.com/perses/plugins/releases/download/piechart/v0.6.0/PieChart-0.6.0.tar.gz";
|
||||
hash = "sha256-AseYkh7Vl1TQJbOPwuMmCvKQls79fIQHQb7Gq6yZIUE=";
|
||||
};
|
||||
"Prometheus" = {
|
||||
version = "0.51.0-beta.2";
|
||||
url = "https://github.com/perses/plugins/releases/download/prometheus/v0.51.0-beta.2/Prometheus-0.51.0-beta.2.tar.gz";
|
||||
hash = "sha256-PUsaZyycDDNaIIhBPIjxnucij9yYZP2TxsX2GvqUTVo=";
|
||||
};
|
||||
"ScatterChart" = {
|
||||
version = "0.6.0";
|
||||
url = "https://github.com/perses/plugins/releases/download/scatterchart/v0.6.0/ScatterChart-0.6.0.tar.gz";
|
||||
hash = "sha256-M1g/EWL5P/jSeTYMGTShuD+AavqK9vJkLeOjYX+dP3c=";
|
||||
};
|
||||
"StatChart" = {
|
||||
version = "0.6.0";
|
||||
url = "https://github.com/perses/plugins/releases/download/statchart/v0.6.0/StatChart-0.6.0.tar.gz";
|
||||
hash = "sha256-lxT2Zimo62i6dLR01uuEgcYs55LLlqyuXIv0DGZlAaM=";
|
||||
};
|
||||
"StaticListVariable" = {
|
||||
version = "0.3.0";
|
||||
url = "https://github.com/perses/plugins/releases/download/staticlistvariable/v0.3.0/StaticListVariable-0.3.0.tar.gz";
|
||||
hash = "sha256-1PmMDuWIq7ALV8DqqL+XJilkfGV2qXVOy9ZMTQrzRq8=";
|
||||
};
|
||||
"StatusHistoryChart" = {
|
||||
version = "0.6.0";
|
||||
url = "https://github.com/perses/plugins/releases/download/statushistorychart/v0.6.0/StatusHistoryChart-0.6.0.tar.gz";
|
||||
hash = "sha256-+U5IIZME3FXACIh3S725tuCdbTzlVRUrU9LFSldnMiI=";
|
||||
};
|
||||
"Table" = {
|
||||
version = "0.6.0";
|
||||
url = "https://github.com/perses/plugins/releases/download/table/v0.6.0/Table-0.6.0.tar.gz";
|
||||
hash = "sha256-pndqD5lrwXe66GiaC+NQgFJiaSJasldpmgwrnEAFmJU=";
|
||||
};
|
||||
"Tempo" = {
|
||||
version = "0.51.0-beta.2";
|
||||
url = "https://github.com/perses/plugins/releases/download/tempo/v0.51.0-beta.2/Tempo-0.51.0-beta.2.tar.gz";
|
||||
hash = "sha256-p1ey0we7ncsnoIcCNhlmzp3NRNrxtayTKruJCuR50gw=";
|
||||
};
|
||||
"TimeSeriesChart" = {
|
||||
version = "0.6.0";
|
||||
url = "https://github.com/perses/plugins/releases/download/timeserieschart/v0.6.0/TimeSeriesChart-0.6.0.tar.gz";
|
||||
hash = "sha256-6inzw4W7lakhbmVDkrgA8uwI6MLiVuk1xbiy904y6Ig=";
|
||||
};
|
||||
"TimeSeriesTable" = {
|
||||
version = "0.6.0";
|
||||
url = "https://github.com/perses/plugins/releases/download/timeseriestable/v0.6.0/TimeSeriesTable-0.6.0.tar.gz";
|
||||
hash = "sha256-bkVhkfRZXGgKZGrQ9crag92jFFiRxZaZOb/UyBTyWGM=";
|
||||
};
|
||||
"TraceTable" = {
|
||||
version = "0.6.0";
|
||||
url = "https://github.com/perses/plugins/releases/download/tracetable/v0.6.0/TraceTable-0.6.0.tar.gz";
|
||||
hash = "sha256-u8/NW23rGX2sAyuVoL7pH1WFYOhcdMFlzE4qMvMBYgE=";
|
||||
};
|
||||
"TracingGanttChart" = {
|
||||
version = "0.6.0";
|
||||
url = "https://github.com/perses/plugins/releases/download/tracingganttchart/v0.6.0/TracingGanttChart-0.6.0.tar.gz";
|
||||
hash = "sha256-R1U/Uq5QPVQWBe24IKovRXCsCyuUmATBcnqxRuRD+Aw=";
|
||||
};
|
||||
}
|
35
pkgs/by-name/pe/perses/update.sh
Executable file
35
pkgs/by-name/pe/perses/update.sh
Executable file
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p nix-update yq
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
nix-update "${UPDATE_NIX_ATTR_PATH}" --version=unstable
|
||||
|
||||
src="$(nix-build -A "${UPDATE_NIX_ATTR_PATH}".src --no-out-link)"
|
||||
|
||||
(
|
||||
echo "# This file has been autogenerated by update.sh"
|
||||
echo "# Do not edit this file manually."
|
||||
|
||||
echo "{"
|
||||
|
||||
yq -r '.[]|[.name, .version] | @tsv' < "${src}/scripts/plugin/plugin.yaml" \
|
||||
| while IFS=$'\t' read -r name version; do
|
||||
echo " \"${name}\" = {"
|
||||
|
||||
echo " version = \"${version}\";"
|
||||
|
||||
url="https://github.com/perses/plugins/releases/download/${name,,}/v${version}/${name}-${version}.tar.gz"
|
||||
echo " url = \"${url}\";"
|
||||
|
||||
hash="$(nix-prefetch-url "${url}" --name "${UPDATE_NIX_PNAME}-${name,,}-${version}.tar.gz")"
|
||||
hash="$(nix hash convert --hash-algo sha256 "${hash}")"
|
||||
|
||||
echo " hash = \"${hash}\";"
|
||||
|
||||
echo " };"
|
||||
done
|
||||
|
||||
echo "}"
|
||||
) > "$(dirname "${BASH_SOURCE[0]}")/plugins.nix"
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue