nix/pkgs/grafana-plugins: rework a bit

This commit is contained in:
Luke Granger-Brown 2020-12-30 03:30:24 +00:00
parent 405997d312
commit eb9d9f54a5
2 changed files with 50 additions and 3 deletions

View file

@ -1,8 +1,9 @@
{ pkgs, ... }: { pkgs, ... }:
with pkgs;
let let
packageGrafanaPlugin = { pname, version, sha256, ... }@args: packageGrafanaPlugin = { pname, version, sha256, meta ? {}, ... }@args:
with pkgs; stdenv.mkDerivation rec { stdenv.mkDerivation {
inherit pname version; inherit pname version;
src = fetchurl { src = fetchurl {
@ -17,12 +18,55 @@ let
mkdir $out mkdir $out
cp -R * "$out" cp -R * "$out"
''; '';
};
meta = meta // {
homepage = "https://grafana.com/grafana/plugins/${pname}";
};
} // (builtins.removeAttrs args [ "pname" "version" "sha256" "meta" ]);
in in
{ {
grafana-piechart-panel = packageGrafanaPlugin { grafana-piechart-panel = packageGrafanaPlugin {
pname = "grafana-piechart-panel"; pname = "grafana-piechart-panel";
version = "1.6.1"; version = "1.6.1";
sha256 = "sha256:0f6snd2p3hq3gqmbvc6rnjx97k3lagcfyw62lx2y0ah1z9wvz0pb"; sha256 = "sha256:0f6snd2p3hq3gqmbvc6rnjx97k3lagcfyw62lx2y0ah1z9wvz0pb";
meta = with lib; {
description = "Pie chart panel for Grafana";
license = licenses.asl20;
maintainers = with maintainers; [ lukegb ];
platforms = platforms.unix;
};
};
grafana-clock-panel = packageGrafanaPlugin {
pname = "grafana-clock-panel";
version = "1.1.1";
sha256 = "sha256:0fa4ajd64q9anz7xg6parqjp79lz9wdc761sxsi6wp7ypa1p5xja";
meta = with lib; {
description = "Clock panel for Grafana";
license = licenses.asl20;
maintainers = with maintainers; [ lukegb ];
platforms = platforms.unix;
};
};
grafana-worldmap-panel = packageGrafanaPlugin {
pname = "grafana-worldmap-panel";
version = "0.3.2";
sha256 = "sha256:00dfd87kwrq41wc95vnxgidyh4kjylqydx6xq9x5rxsp5z6hjq1h";
meta = with lib; {
description = "World Map panel for Grafana";
license = licenses.asl20;
maintainers = with maintainers; [ lukegb ];
platforms = platforms.unix;
};
};
grafana-polystat-panel = packageGrafanaPlugin {
pname = "grafana-polystat-panel";
version = "1.2.2";
sha256 = "sha256:1mzyg8mk1vap4x65xnqkw14nsrhv1v4nfq9b7sbkpb37rf31sr0x";
meta = with lib; {
description = "Hexagonal multi-stat panel for Grafana";
license = licenses.asl20;
maintainers = with maintainers; [ lukegb ];
platforms = platforms.unix;
};
}; };
} }

View file

@ -231,6 +231,9 @@ in {
cfg = config.services.grafana; cfg = config.services.grafana;
plugins = with depot.pkgs.grafana-plugins; [ plugins = with depot.pkgs.grafana-plugins; [
grafana-piechart-panel grafana-piechart-panel
grafana-clock-panel
grafana-worldmap-panel
grafana-polystat-panel
]; ];
pluginLines = lib.concatMapStringsSep "\n" (pkg: '' pluginLines = lib.concatMapStringsSep "\n" (pkg: ''
ln -sf ${pkg} ${cfg.dataDir}/plugins/${pkg.pname} ln -sf ${pkg} ${cfg.dataDir}/plugins/${pkg.pname}