depot/cluster/services/monitoring/provisioning/dashboards.nix

25 lines
571 B
Nix
Raw Normal View History

{ lib, pkgs, ... }:
let
loadDashboard = file: lib.pipe file [
lib.importJSON
({ dashboard, ... }: rec {
name = "provision-dashboard-${dashboard.uid}.json";
path = builtins.toFile name (builtins.toJSON dashboard);
})
];
dashboardsDir = pkgs.linkFarm
"grafana-provisioning-dashboards"
(map loadDashboard (lib.filesystem.listFilesRecursive ./objects/dashboards));
in
{
services.grafana.provision.dashboards.settings = {
providers = lib.singleton {
options.path = dashboardsDir;
allowUiUpdates = true;
};
};
}