Added grafana config

This commit is contained in:
Alejandro Angulo 2023-09-07 19:37:05 -07:00
parent 28fe66a888
commit 5e38e0c49c
Signed by: alejandro-angulo
GPG key ID: 75579581C74554B6
2 changed files with 58 additions and 0 deletions

View file

@ -0,0 +1,52 @@
{
options,
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.aa.services.grafana;
server_settings = config.services.grafana.settings.server;
in {
options.aa.services.grafana = with types; {
enable = mkEnableOption "grafana";
acmeCertName = mkOption {
type = str;
default = "";
description = ''
If set to a non-empty string, forces SSL with the supplied acme
certificate.
'';
};
};
config = mkIf cfg.enable {
services.grafana = {
enable = true;
settings.server = {
domain = "grafana.kilonull.com";
http_port = 2342;
http_addr = "0.0.0.0";
};
};
services.nginx = {
enable = true;
virtualHosts ."${server_settings.domain}" =
{
locations."/" = {
proxyPass = "http://${server_settings.http_addr}:${toString server_settings.http_port}";
proxyWebsockets = true;
};
}
// lib.optionalAttrs (cfg.acmeCertName != "") {
forceSSL = true;
useACMEHost = cfg.acmeCertName;
};
};
networking.firewall = {
allowedTCPPorts = [80 443];
};
};
}

View file

@ -14,6 +14,8 @@
nix.enable = true; nix.enable = true;
nix.useSelfhostedCache = true; nix.useSelfhostedCache = true;
apps.tmux.enable = true;
services.tailscale = { services.tailscale = {
enable = true; enable = true;
configureClientRouting = true; configureClientRouting = true;
@ -28,6 +30,10 @@
enable = true; enable = true;
acmeCertName = "kilonull.com"; acmeCertName = "kilonull.com";
}; };
services.grafana = {
enable = true;
acmeCertName = "kilonull.com";
};
services.syncoid = { services.syncoid = {
# sudo -u backups zfs create -o mountpoint=/tank/backups/gospel tank/backups/gospel # sudo -u backups zfs create -o mountpoint=/tank/backups/gospel tank/backups/gospel
enable = true; enable = true;