diff --git a/configs/nixos/ni/default.nix b/configs/nixos/ni/default.nix index e2c199dc..4f5b4e34 100644 --- a/configs/nixos/ni/default.nix +++ b/configs/nixos/ni/default.nix @@ -18,6 +18,7 @@ hardware.qol.enable = true; networking.enable = true; services.backup.enable = true; + services.monitoring.enable = true; setups = { desktop.enable = true; development.enable = true; diff --git a/configs/nixos/ni/modules/default.nix b/configs/nixos/ni/modules/default.nix index 0230d79f..e6a53956 100644 --- a/configs/nixos/ni/modules/default.nix +++ b/configs/nixos/ni/modules/default.nix @@ -5,6 +5,7 @@ ./networking/setup.nix ./networking/wireguard.nix ./services/backup + ./services/monitoring.nix ./services/download-media ./setups/desktop.nix ./setups/development.nix diff --git a/configs/nixos/ni/modules/services/monitoring.nix b/configs/nixos/ni/modules/services/monitoring.nix new file mode 100644 index 00000000..06730711 --- /dev/null +++ b/configs/nixos/ni/modules/services/monitoring.nix @@ -0,0 +1,35 @@ +{ config, lib, pkgs, ... }: + +let + hostCfg = config.hosts.ni; + cfg = hostCfg.services.monitoring; +in +{ + options.hosts.ni.services.monitoring.enable = + lib.mkEnableOption "enable local desktop monitoring service"; + + config = lib.mkIf cfg.enable { + state.ports.grafana.value = 24532; + + services.grafana.enable = true; + + services.grafana.declarativePlugins = with pkgs.grafanaPlugins; [ + grafana-piechart-panel + ]; + + services.grafana.settings = { + database.type = "sqlite3"; + server = { + http_address = "localhost"; + http_port = config.state.ports.grafana.value; + }; + + # It's a local instance for a local use so there's not much to + # worry about. + security = { + admin_password = "admin"; + admin_user = "admin"; + }; + }; + }; +}