34 lines
763 B
Nix
34 lines
763 B
Nix
{
|
|
pkgs,
|
|
lib,
|
|
config,
|
|
...
|
|
}: let
|
|
cfg = config.services.grafanaWithNginx;
|
|
in {
|
|
options.services."grafanaWithNginx" = with lib; {
|
|
enable =
|
|
mkEnableOption "Configured grafana instance with nginx reverse proxy";
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
services.grafana = {
|
|
enable = true;
|
|
domain = "data.ccqcraft.de";
|
|
port = 2342;
|
|
addr = "127.0.0.1";
|
|
auth.anonymous.enable = false;
|
|
};
|
|
|
|
services.nginx.virtualHosts.${config.services.grafana.domain} = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
serverAliases = ["data.tammena.rocks"];
|
|
locations."/" = {
|
|
proxyPass = "http://127.0.0.1:${toString config.services.grafana.port}";
|
|
proxyWebsockets = true;
|
|
};
|
|
};
|
|
};
|
|
}
|