From eb9d9f54a5911eb3fbec77999271208c55588475 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Wed, 30 Dec 2020 03:30:24 +0000 Subject: [PATCH] nix/pkgs/grafana-plugins: rework a bit --- nix/pkgs/grafana-plugins/default.nix | 50 ++++++++++++++++++++++++++-- ops/nixos/totoro/default.nix | 3 ++ 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/nix/pkgs/grafana-plugins/default.nix b/nix/pkgs/grafana-plugins/default.nix index 62a2104932..77fb3faf09 100644 --- a/nix/pkgs/grafana-plugins/default.nix +++ b/nix/pkgs/grafana-plugins/default.nix @@ -1,8 +1,9 @@ { pkgs, ... }: +with pkgs; let - packageGrafanaPlugin = { pname, version, sha256, ... }@args: - with pkgs; stdenv.mkDerivation rec { + packageGrafanaPlugin = { pname, version, sha256, meta ? {}, ... }@args: + stdenv.mkDerivation { inherit pname version; src = fetchurl { @@ -17,12 +18,55 @@ let mkdir $out cp -R * "$out" ''; - }; + + meta = meta // { + homepage = "https://grafana.com/grafana/plugins/${pname}"; + }; + } // (builtins.removeAttrs args [ "pname" "version" "sha256" "meta" ]); in { grafana-piechart-panel = packageGrafanaPlugin { pname = "grafana-piechart-panel"; version = "1.6.1"; 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; + }; }; } diff --git a/ops/nixos/totoro/default.nix b/ops/nixos/totoro/default.nix index f56fd28b1b..493ff99e4c 100644 --- a/ops/nixos/totoro/default.nix +++ b/ops/nixos/totoro/default.nix @@ -231,6 +231,9 @@ in { cfg = config.services.grafana; plugins = with depot.pkgs.grafana-plugins; [ grafana-piechart-panel + grafana-clock-panel + grafana-worldmap-panel + grafana-polystat-panel ]; pluginLines = lib.concatMapStringsSep "\n" (pkg: '' ln -sf ${pkg} ${cfg.dataDir}/plugins/${pkg.pname}