This commit is contained in:
Joakim Repomaa
2025-02-12 20:58:42 +02:00
parent dd4e5c63e3
commit c519f8d83e
17 changed files with 182 additions and 252 deletions

View File

@@ -1,32 +1,21 @@
{ lib, config, ... }:
let
cfg = config.modules.services.grafana;
cfg = config.services.grafana;
secrets = config.age.secrets;
fqdn = "${cfg.subdomain}.${config.networking.domain}";
in
{
options.modules.services.grafana = {
enable = lib.mkEnableOption "Enable Grafana";
options.services.grafana = {
subdomain = lib.mkOption {
type = lib.types.str;
};
config = lib.mkOption {
type = lib.types.attrs;
};
port = lib.mkOption {
type = lib.types.int;
default = 3300;
};
};
config = lib.mkIf cfg.enable {
services.grafana = {
enable = true;
settings = {
server = {
root_url = "https://${fqdn}";
http_port = cfg.port;
};
database = {
@@ -36,11 +25,7 @@ in
};
smtp = {
enabled = true;
host = "horologium.uberspace.de";
from_address = "noreply@freun.dev";
from_name = "Vaultwarden";
user = "noreply@freun.dev";
from_name = "Grafana";
password = "$__file{${secrets.smtp-password.path}}";
};
};
@@ -59,7 +44,7 @@ in
];
};
modules.services.webserver.vHosts.${fqdn}.locations."/".proxyPort = cfg.port;
services.webserver.vHosts.${fqdn}.locations."/".proxyPort = cfg.settings.server.http_port;
services.postgresql = {
enable = lib.mkDefault true;