rename grafana-server, move some things around

This commit is contained in:
daragh 2024-05-21 02:51:15 +01:00
parent 115535c386
commit 70b1d6324d
No known key found for this signature in database

View file

@ -1,14 +1,19 @@
{lib, ...}: {
lib,
config,
...
}:
with lib; let with lib; let
name = "grafana-server"; name = "grafana";
cfg = config.services.skynet.grafana; cfg = config.services.skynet.grafana;
port = 4444;
in { in {
imports = [ imports = [
./acme.nix ./acme.nix
./dns.nix ./dns.nix
]; ];
options.services.skynet.grafana = { options.services.skynet."${name}" = {
enable = mkEnableOption "Grafana Server"; enable = mkEnableOption "Grafana Server";
host = { host = {
@ -27,27 +32,11 @@ in {
port = mkOption { port = mkOption {
type = types.port; type = types.port;
default = 4444; default = port;
}; };
}; };
config = { config = mkIf cfg.enable {
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;
};
};
skynet_dns.records = [ skynet_dns.records = [
{ {
record = "${name}"; record = "${name}";
@ -59,5 +48,23 @@ in {
skynet_acme.domains = [ skynet_acme.domains = [
"${name}.skynet.ie" "${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;
};
};
};
}; };
} }