mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 19:51:34 +01:00
grafana: Init basic module
This commit is contained in:
parent
fd9005567f
commit
f6f17802ff
3 changed files with 55 additions and 2 deletions
42
modules/system/services/grafana.nix
Normal file
42
modules/system/services/grafana.nix
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.custom.services.grafana;
|
||||
in
|
||||
{
|
||||
options.custom.services.grafana = {
|
||||
enable = lib.mkEnableOption "";
|
||||
doBackups = lib.mkEnableOption "";
|
||||
domain = lib.mkOption {
|
||||
type = lib.types.nonEmptyStr;
|
||||
default = "";
|
||||
};
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 3000;
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
meta = {
|
||||
domains.list = [ cfg.domain ];
|
||||
ports.list = [ cfg.port ];
|
||||
};
|
||||
|
||||
sops.secrets."grafana/admin-password".owner = config.users.users.grafana.name;
|
||||
|
||||
services.grafana = {
|
||||
enable = true;
|
||||
settings = {
|
||||
server = {
|
||||
inherit (cfg) domain;
|
||||
http_port = cfg.port;
|
||||
enforce_domain = true;
|
||||
enable_gzip = true;
|
||||
};
|
||||
security.admin_password = "$__file{${config.sops.secrets."grafana/admin-password".path}}";
|
||||
users.default_theme = "system";
|
||||
analytics.reporting_enabled = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue