Merge pull request #107980 from lukegb/grafana-plugins

Add Nix packages for Grafana plugins and allow declarative installation
This commit is contained in:
WilliButz
2021-01-01 16:00:17 +01:00
committed by GitHub
11 changed files with 128 additions and 2 deletions
@@ -0,0 +1,7 @@
{ newScope, pkgs }:
let
callPackage = newScope (pkgs // plugins);
plugins = import ./plugins.nix { inherit callPackage; };
in
plugins
@@ -0,0 +1,13 @@
{ grafanaPlugin, lib }:
grafanaPlugin rec {
pname = "grafana-clock-panel";
version = "1.1.1";
zipHash = "sha256-SvZyg7r+XG6i7jqYwxpPn6ZzJc7qmtfPtyphYppURDk=";
meta = with lib; {
description = "Clock panel for Grafana";
license = licenses.asl20;
maintainers = with maintainers; [ lukegb ];
platforms = platforms.unix;
};
}
@@ -0,0 +1,13 @@
{ grafanaPlugin, lib }:
grafanaPlugin rec {
pname = "grafana-piechart-panel";
version = "1.6.1";
zipHash = "sha256-64K/efoBKuBFp8Jw79hTdMyTurTZsL0qfgPDcUWz2jg=";
meta = with lib; {
description = "Pie chart panel for Grafana";
license = licenses.asl20;
maintainers = with maintainers; [ lukegb ];
platforms = platforms.unix;
};
}
@@ -0,0 +1,28 @@
{ stdenvNoCC, fetchurl, unzip }:
{ pname, version, zipHash, meta ? {}, passthru ? {}, ... }@args:
stdenvNoCC.mkDerivation ({
inherit pname version;
src = fetchurl {
name = "${pname}-${version}.zip";
url = "https://grafana.com/api/plugins/${pname}/versions/${version}/download";
hash = zipHash;
};
nativeBuildInputs = [ unzip ];
installPhase = ''
cp -R "." "$out"
chmod -R a-w "$out"
chmod u+w "$out"
'';
passthru = {
updateScript = [ ./update-grafana-plugin.sh pname ];
} // passthru;
meta = {
homepage = "https://grafana.com/grafana/plugins/${pname}";
} // meta;
} // (builtins.removeAttrs args [ "pname" "version" "sha256" "meta" ]))
@@ -0,0 +1,13 @@
{ grafanaPlugin, lib }:
grafanaPlugin rec {
pname = "grafana-polystat-panel";
version = "1.2.2";
zipHash = "sha256-HWQdhstnrDuXPithZ8kOG2ZtSeAT215MJ1ftMCt6/tc=";
meta = with lib; {
description = "Hexagonal multi-stat panel for Grafana";
license = licenses.asl20;
maintainers = with maintainers; [ lukegb ];
platforms = platforms.unix;
};
}
@@ -0,0 +1,13 @@
{ grafanaPlugin, lib }:
grafanaPlugin rec {
pname = "grafana-worldmap-panel";
version = "0.3.2";
zipHash = "sha256-MGAJzS9X91x6wt305jH1chLoW3zd7pIYDwRnPg9qrgE=";
meta = with lib; {
description = "World Map panel for Grafana";
license = licenses.asl20;
maintainers = with maintainers; [ lukegb ];
platforms = platforms.unix;
};
}
@@ -0,0 +1,11 @@
{ callPackage }:
{
inherit callPackage;
grafanaPlugin = callPackage ./grafana-plugin.nix { };
grafana-clock-panel = callPackage ./grafana-clock-panel { };
grafana-piechart-panel = callPackage ./grafana-piechart-panel { };
grafana-polystat-panel = callPackage ./grafana-polystat-panel { };
grafana-worldmap-panel = callPackage ./grafana-worldmap-panel { };
}
@@ -0,0 +1,8 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq common-updater-scripts
set -eu -o pipefail
readonly plugin_name="$1"
readonly latest_version="$(curl "https://grafana.com/api/plugins/${plugin_name}" | jq -r .version)"
update-source-version "grafanaPlugins.${plugin_name}" "$latest_version"