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
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;
};
};
};
};
}