initial(ish) commit
This commit is contained in:
commit
b744693f0e
88 changed files with 4925 additions and 0 deletions
32
nixos-modules/services/grafana.nix
Normal file
32
nixos-modules/services/grafana.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.ragon.services.grafana;
|
||||
domain = config.ragon.services.nginx.domain;
|
||||
in
|
||||
{
|
||||
options.ragon.services.grafana.enable = lib.mkEnableOption "Enables grafana";
|
||||
options.ragon.services.grafana.domainPrefix =
|
||||
lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "grafana";
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.grafana = {
|
||||
enable = true;
|
||||
domain = "${cfg.domainPrefix}.${domain}";
|
||||
rootUrl = "https://${cfg.domainPrefix}.${domain}/";
|
||||
};
|
||||
services.nginx.virtualHosts."${cfg.domainPrefix}.${domain}" = {
|
||||
useACMEHost = "${domain}";
|
||||
addSSL = true;
|
||||
locations = {
|
||||
"/".proxyPass = "http://127.0.0.1:${toString config.services.grafana.port}";
|
||||
"/".proxyWebsockets = true;
|
||||
};
|
||||
};
|
||||
|
||||
ragon.persist.extraDirectories = [
|
||||
"${config.services.grafana.dataDir}"
|
||||
];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue