services/grafana: init
This commit is contained in:
parent
afafd02d9a
commit
5cb6dac8ea
2 changed files with 57 additions and 0 deletions
52
modules/services/grafana/module.nix
Normal file
52
modules/services/grafana/module.nix
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.options) mkEnableOption;
|
||||||
|
|
||||||
|
cfg = config.modules.system.services.grafana;
|
||||||
|
in {
|
||||||
|
options.modules.system.services.grafana.enable = mkEnableOption "Grafana, a graphing service";
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
networking.firewall.allowedTCPPorts = [config.services.grafana.settings.server.http_port];
|
||||||
|
|
||||||
|
modules.system.services.database.postgresql.enable = true;
|
||||||
|
|
||||||
|
services.grafana = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.grafana;
|
||||||
|
|
||||||
|
port = 4021;
|
||||||
|
domain = "localhost";
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
server = {
|
||||||
|
http_addr = "127.0.0.1";
|
||||||
|
http_port = 4021;
|
||||||
|
|
||||||
|
root_url = "https://info.copeberg.org";
|
||||||
|
domain = "info.copeberg.org";
|
||||||
|
enforce_domain = true;
|
||||||
|
};
|
||||||
|
database = {
|
||||||
|
type = "postgres";
|
||||||
|
host = "/run/postgresql";
|
||||||
|
name = "grafana";
|
||||||
|
user = "grafana";
|
||||||
|
ssl_mode = "disable";
|
||||||
|
};
|
||||||
|
|
||||||
|
analytics = {
|
||||||
|
reporting_enabled = false;
|
||||||
|
check_for_updates = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
# users.allow_signup = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -27,6 +27,7 @@ in {
|
||||||
|
|
||||||
ensureDatabases = [
|
ensureDatabases = [
|
||||||
"git"
|
"git"
|
||||||
|
"grafana"
|
||||||
];
|
];
|
||||||
|
|
||||||
ensureUsers = [
|
ensureUsers = [
|
||||||
|
@ -44,6 +45,10 @@ in {
|
||||||
name = "git";
|
name = "git";
|
||||||
ensureDBOwnership = true;
|
ensureDBOwnership = true;
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
name = "grafana";
|
||||||
|
ensureDBOwnership = true;
|
||||||
|
}
|
||||||
];
|
];
|
||||||
settings = {
|
settings = {
|
||||||
# taken from https://pgconfigurator.cybertec.at/
|
# taken from https://pgconfigurator.cybertec.at/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue