rename grafana-server, move some things around
This commit is contained in:
parent
115535c386
commit
70b1d6324d
1 changed files with 28 additions and 21 deletions
|
@ -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;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue