waffentrager: add disabled grafana

This commit is contained in:
Mateusz Słodkowicz 2024-09-02 23:19:58 +02:00
parent fd5e096b37
commit fde2617ea8
Signed by: materus
GPG Key ID: 28D140BCA60B4FD1
2 changed files with 41 additions and 0 deletions

View File

@ -11,6 +11,7 @@
./samba.nix ./samba.nix
./syncthing.nix ./syncthing.nix
./jellyfin.nix ./jellyfin.nix
./grafana.nix
./auth ./auth
]; ];
waffentragerService.elements.enable = true; waffentragerService.elements.enable = true;
@ -22,4 +23,5 @@
waffentragerService.samba.enable = true; waffentragerService.samba.enable = true;
waffentragerService.jellyfin.enable = true; waffentragerService.jellyfin.enable = true;
waffentragerService.syncthing.enable = true; waffentragerService.syncthing.enable = true;
waffentragerService.grafana.enable = false;
} }

View File

@ -0,0 +1,39 @@
{ materusArg, config, lib, ... }:
{
options.waffentragerService.grafana.enable = materusArg.pkgs.lib.mkBoolOpt false "Enable grafana";
config =
let
cfg = config.waffentragerService.grafana;
in
lib.mkIf cfg.enable {
services.grafana = {
dataDir = "${config.waffentragerService.elements.path}/services/grafana";
enable = true;
settings = {
server = {
# Listening Address
http_addr = "127.0.0.1";
# and Port
http_port = 3232;
# Grafana needs to know on which domain and URL it's running
domain = "watchman.materus.pl";
serve_from_sub_path = true;
};
};
};
services.nginx.virtualHosts."watchman.materus.pl" = {
addSSL = true;
sslTrustedCertificate = "/var/lib/mnt_acme/materus.pl/chain.pem";
sslCertificateKey = "/var/lib/mnt_acme/materus.pl/key.pem";
sslCertificate = "/var/lib/mnt_acme/materus.pl/fullchain.pem";
http2 = false;
http3 = true;
locations."/" = {
proxyPass = "http://${toString config.services.grafana.settings.server.http_addr}:${toString config.services.grafana.settings.server.http_port}";
proxyWebsockets = true;
recommendedProxySettings = true;
};
};
};
}