From 405997d312f88c4b117007b8e7723b98f3d22919 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Wed, 30 Dec 2020 02:56:31 +0000 Subject: [PATCH] totoro: teach how to install grafana plugins from nix --- ops/nixos/totoro/default.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ops/nixos/totoro/default.nix b/ops/nixos/totoro/default.nix index 7caa231d77..f56fd28b1b 100644 --- a/ops/nixos/totoro/default.nix +++ b/ops/nixos/totoro/default.nix @@ -227,6 +227,19 @@ in { security.cookie_secure = "true"; }; }; + systemd.services.grafana.preStart = let + cfg = config.services.grafana; + plugins = with depot.pkgs.grafana-plugins; [ + grafana-piechart-panel + ]; + pluginLines = lib.concatMapStringsSep "\n" (pkg: '' + ln -sf ${pkg} ${cfg.dataDir}/plugins/${pkg.pname} + '') plugins; + in lib.mkAfter '' + rm -rf ${cfg.dataDir}/plugins + mkdir ${cfg.dataDir}/plugins + ${pluginLines} + ''; system.stateVersion = "20.03"; }