mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-25 17:38:29 +02:00
* fix: Grafana's secret key doesn't have a default value anymore
flake.lock: Update
Flake lock file updates:
• Updated input 'mysecrets':
'git+ssh://git@github.com/ryan4yin/nix-secrets.git?ref=refs/heads/main&rev=cfe34c222cf7ee4290438c97e6cc734aa7792346&shallow=1' (2025-12-18)
→ 'git+ssh://git@github.com/ryan4yin/nix-secrets.git?ref=refs/heads/main&rev=86de5313787257806723f03dccabd52bb7501ff3&shallow=1' (2026-03-18)
* fix: gitea sendmail path
* fix: transmission_4
79 lines
2.5 KiB
Nix
79 lines
2.5 KiB
Nix
{
|
|
pkgs,
|
|
config,
|
|
myvars,
|
|
...
|
|
}:
|
|
{
|
|
|
|
imports = [
|
|
./dashboards.nix
|
|
./datasources.nix
|
|
];
|
|
|
|
services.grafana = {
|
|
enable = true;
|
|
dataDir = "/data/apps/grafana";
|
|
provision.enable = true;
|
|
settings = {
|
|
server = {
|
|
http_addr = "127.0.0.1";
|
|
http_port = 3351;
|
|
protocol = "http";
|
|
domain = "grafana.writefo.fun";
|
|
# Redirect to correct domain if the host header does not match the domain. Prevents DNS rebinding attacks.
|
|
serve_from_sub_path = false;
|
|
# Add subpath to the root_url if serve_from_sub_path is true
|
|
root_url = "%(protocol)s://%(domain)s:%(http_port)s/";
|
|
enforce_domain = false;
|
|
read_timeout = "180s";
|
|
# Enable HTTP compression, this can improve transfer speed and bandwidth utilization.
|
|
enable_gzip = true;
|
|
# Cdn for accelerating loading of frontend assets.
|
|
# cdn_url = "https://cdn.jsdelivr.net/npm/grafana@7.5.5";
|
|
};
|
|
|
|
security = {
|
|
admin_user = myvars.username;
|
|
admin_email = myvars.useremail;
|
|
# Use file provider to read the admin password from a file.
|
|
# https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#file-provider
|
|
admin_password = "$__file{${config.age.secrets."grafana-admin-password".path}}";
|
|
secret_key = "$__file{${config.age.secrets."grafana-secret-key".path}}";
|
|
};
|
|
users = {
|
|
allow_sign_up = false;
|
|
# home_page = "";
|
|
default_theme = "dark";
|
|
};
|
|
};
|
|
|
|
# https://github.com/NixOS/nixpkgs/tree/master/pkgs/servers/monitoring/grafana/plugins
|
|
declarativePlugins = with pkgs.grafanaPlugins; [
|
|
# https://github.com/VictoriaMetrics/victoriametrics-datasource
|
|
# supports victoria-metrics's MetricsQL, template, tracing, prettify, etc.
|
|
victoriametrics-metrics-datasource
|
|
# https://github.com/VictoriaMetrics/victorialogs-datasource
|
|
victoriametrics-logs-datasource
|
|
|
|
redis-app
|
|
redis-datasource
|
|
redis-explorer-app
|
|
|
|
grafana-googlesheets-datasource
|
|
grafana-github-datasource
|
|
grafana-clickhouse-datasource
|
|
grafana-mqtt-datasource
|
|
frser-sqlite-datasource
|
|
|
|
# https://github.com/grafana/grafana-infinity-datasource
|
|
# Visualize data from JSON, CSV, XML, GraphQL and HTML endpoints in Grafana
|
|
yesoreyeram-infinity-datasource
|
|
|
|
# plugins not included in nixpkgs: trino, grafana advisor, llm, kafka
|
|
];
|
|
};
|
|
|
|
environment.etc."grafana/dashboards".source = ./dashboards;
|
|
}
|