2023-08-10 07:59:29 +00:00
|
|
|
{ lib, mkYarnPackage, fetchFromGitHub, fetchYarnDeps, nodejs, runtimeShell }:
|
2021-01-05 17:05:55 +00:00
|
|
|
|
|
|
|
# Notes for the upgrade:
|
|
|
|
# * Download the tarball of the new version to use.
|
2023-08-10 07:59:29 +00:00
|
|
|
# * Replace new `package.json` here.
|
2021-01-05 17:05:55 +00:00
|
|
|
# * Update `version`+`hash` and rebuild.
|
|
|
|
|
|
|
|
mkYarnPackage rec {
|
2021-08-05 21:33:18 +00:00
|
|
|
pname = "grafana-image-renderer";
|
2023-10-19 13:55:26 +00:00
|
|
|
version = "3.8.3";
|
2021-01-05 17:05:55 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "grafana";
|
|
|
|
repo = "grafana-image-renderer";
|
2021-03-12 07:09:13 +00:00
|
|
|
rev = "v${version}";
|
2023-10-19 13:55:26 +00:00
|
|
|
hash = "sha256-3CaIVOzya0euQEpFAqqwy9L6Dn6qxPzpYFjJOL80Ka0=";
|
2021-01-05 17:05:55 +00:00
|
|
|
};
|
|
|
|
|
2023-08-10 07:59:29 +00:00
|
|
|
offlineCache = fetchYarnDeps {
|
|
|
|
yarnLock = src + "/yarn.lock";
|
2023-10-19 13:55:26 +00:00
|
|
|
hash = "sha256-GQ4dV3tyyKSYDA1tUgB+VaUBKIktdbx0o6GgBLQQkFc=";
|
2023-08-10 07:59:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
packageJSON = ./package.json;
|
|
|
|
|
2021-01-05 17:05:55 +00:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
|
|
|
pushd deps/renderer
|
2022-06-16 17:23:12 +00:00
|
|
|
yarn run build
|
2021-01-05 17:05:55 +00:00
|
|
|
popd
|
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
dontInstall = true;
|
|
|
|
|
|
|
|
distPhase = ''
|
|
|
|
runHook preDist
|
|
|
|
|
|
|
|
shopt -s extglob
|
|
|
|
|
|
|
|
pushd deps/renderer
|
|
|
|
install_path="$out/libexec/grafana-image-renderer"
|
|
|
|
mkdir -p $install_path
|
|
|
|
cp -R ../../node_modules $install_path
|
|
|
|
cp -R ./!(node_modules) $install_path
|
|
|
|
popd
|
|
|
|
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cat >$out/bin/grafana-image-renderer <<EOF
|
|
|
|
#! ${runtimeShell}
|
|
|
|
${nodejs}/bin/node $install_path/build/app.js \$@
|
|
|
|
EOF
|
|
|
|
chmod +x $out/bin/grafana-image-renderer
|
|
|
|
|
|
|
|
runHook postDist
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/grafana/grafana-image-renderer";
|
|
|
|
description = "A Grafana backend plugin that handles rendering of panels & dashboards to PNGs using headless browser (Chromium/Chrome)";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ ma27 ];
|
2023-08-10 07:59:29 +00:00
|
|
|
platforms = platforms.all;
|
2021-01-05 17:05:55 +00:00
|
|
|
};
|
|
|
|
}
|