Add grafana #117

Merged
esy merged 7 commits from grafana into main 2024-05-21 02:50:42 +00:00
Showing only changes of commit 70b1d6324d - Show all commits

View file

@ -1,14 +1,19 @@
{lib, ...}:
{
lib,
config,
...
}:
with lib; let
name = "grafana-server";
name = "grafana";
cfg = config.services.skynet.grafana;
port = 4444;
in {
imports = [
./acme.nix
./dns.nix
];
options.services.skynet.grafana = {
options.services.skynet."${name}" = {
enable = mkEnableOption "Grafana Server";
host = {
@ -27,27 +32,11 @@ in {
port = mkOption {
type = types.port;
default = 4444;
default = port;
};
};
config = {
services.grafana = {
enable = true;
domain = "grafana.skynet.ie";
port = cfg.port;
addr = cfg.host.ip;
};
services.nginx.virtualHosts."${name}.skynet.ie" = {
forceSSL = true;
useACMEHost = "skynet";
locations."/" = {
proxyPass = "https://localhost:${toString cfg.port}";
proxyWebsockets = true;
};
};
config = mkIf cfg.enable {
skynet_dns.records = [
{
record = "${name}";
@ -59,5 +48,23 @@ in {
skynet_acme.domains = [
"${name}.skynet.ie"
];
services.grafana = {
enable = true;
domain = "grafana.skynet.ie";
port = cfg.port;
addr = cfg.host.ip;
};
services.nginx.virtualHosts = {
"${name}.skynet.ie" = {
forceSSL = true;
useACMEHost = "skynet";
locations."/" = {
proxyPass = "https://localhost:${toString cfg.port}";
proxyWebsockets = true;
};
};
};
};
}