totoro: teach how to install grafana plugins from nix

This commit is contained in:
Luke Granger-Brown 2020-12-30 02:56:31 +00:00
parent ca4f3c0013
commit 405997d312

View file

@ -227,6 +227,19 @@ in {
security.cookie_secure = "true"; 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"; system.stateVersion = "20.03";
} }