mirror of
https://github.com/teslamate-org/teslamate.git
synced 2026-01-24 21:06:08 +08:00
feat(nix): use datasources.settings.datasources to allow merging Grafana sources from multiple modules, correctly set default Grafana dashboard path and allow disabling default Grafana dashboard with setDefaultDashboard option (#4870)
* feat(nix): use datasources.settings.datasources to allow merging Grafana sources from multiple modules * docs: update changelog * style: linter findings * fix(nix): correctly set default Grafana dashboard path * feat(nix): allow disabling default Grafana dashboard with setDefaultDashboard option * fix(nix): avoid type error by configuring Grafana datasources via provision settings * fix(nix): set default_home_dashboard_path under dashboards section in Grafana settings
This commit is contained in:
@@ -8,6 +8,9 @@
|
||||
|
||||
- feat(webview): show offline duration in extended view on mobile as well to improve UX (#4848 - @JakobLichterfeld)
|
||||
- feat: use Grafana 12.1.0 (#4855 - @swiffer)
|
||||
- feat(nix): use datasources.settings.datasources to allow merging Grafana sources from multiple modules (#4870 - @JakobLichterfeld)
|
||||
- fix(nix): correctly set default Grafana dashboard path (#4870 - @JakobLichterfeld)
|
||||
- feat(nix): allow disabling default Grafana dashboard with setDefaultDashboard option (#4870 - @JakobLichterfeld)
|
||||
|
||||
#### Build, CI, internal
|
||||
|
||||
|
||||
+28
-2
@@ -137,6 +137,12 @@ in
|
||||
default = "/";
|
||||
description = "Path that grafana is mounted on. Useful if using a reverse proxy to vend teslamate and grafana on the same port";
|
||||
};
|
||||
|
||||
setDefaultDashboard = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Whether to set the TeslaMate home dashboard as the default dashboard in Grafana";
|
||||
};
|
||||
};
|
||||
|
||||
mqtt = {
|
||||
@@ -262,14 +268,34 @@ in
|
||||
"auth.anonymous".enabled = false;
|
||||
"auth.basic".enabled = false;
|
||||
analytics.reporting_enabled = false;
|
||||
dashboards.default_home_dashboard_path = "../grafana/dashboards/internal/home.json";
|
||||
dashboards.default_home_dashboard_path = mkIf cfg.grafana.setDefaultDashboard "${pkgs.lib.sources.sourceFilesBySuffices ../grafana/dashboards/internal [".json"]}/home.json";
|
||||
date_formats.use_browser_locale = true;
|
||||
plugins.preinstall_disabled = true;
|
||||
unified_alerting.enabled = false;
|
||||
};
|
||||
provision = {
|
||||
enable = true;
|
||||
datasources.path = ../grafana/datasource.yml;
|
||||
datasources.settings.datasources = [
|
||||
# extracted from ../grafana/datasource.yml
|
||||
{
|
||||
name = "TeslaMate";
|
||||
type = "postgres";
|
||||
url = "http://${cfg.postgres.host}:${toString cfg.postgres.port}";
|
||||
user = cfg.postgres.user;
|
||||
access = "proxy";
|
||||
basicAuth = false;
|
||||
withCredentials = false;
|
||||
isDefault = true;
|
||||
secureJsonData.password = "\${DATABASE_PASS}";
|
||||
jsonData = {
|
||||
postgresVersion = 1500;
|
||||
sslmode = "disable";
|
||||
database = cfg.postgres.database;
|
||||
};
|
||||
version = 1;
|
||||
editable = true;
|
||||
}
|
||||
];
|
||||
# Need to duplicate dashboards.yml since it contains absolute paths
|
||||
# which are incompatible with NixOS
|
||||
dashboards.settings = {
|
||||
|
||||
Reference in New Issue
Block a user