From 6df439251fc46ed230eb245d158954744ef58441 Mon Sep 17 00:00:00 2001 From: Marty Sluijtman Date: Sat, 30 Dec 2023 16:34:24 +0100 Subject: [PATCH] Prometheus module --- flake.nix | 6 ++++-- modules/prometheus.nix | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 modules/prometheus.nix diff --git a/flake.nix b/flake.nix index 8be0273..280ad0b 100644 --- a/flake.nix +++ b/flake.nix @@ -3,7 +3,7 @@ outputs = _: { nixosModules = { - default = { + everything = { imports = [ ./modules/audio.nix @@ -14,14 +14,16 @@ ./modules/vim.nix ./modules/xconfig.nix ./modules/zsh.nix + ./modules/prometheus.nix ]; }; - live = { + server = { imports = [ ./modules/vim.nix ./modules/zsh.nix + ./modules/prometheus.nix ]; }; diff --git a/modules/prometheus.nix b/modules/prometheus.nix new file mode 100644 index 0000000..1cd229c --- /dev/null +++ b/modules/prometheus.nix @@ -0,0 +1,20 @@ +{ lib, config, ... }: +with lib; +let cfg = config.voidcruiser.prometheus; +in { + options.voidcruiser.prometheus = { + enable = mkEnableOption "Enable prometheus node"; + }; + config = mkIf cfg.enable { + services.prometheus = { + enable = true; + exporters = { + node = { + enable = true; + enabledCollectors = [ "systemd" "cpu" ]; + port = 9002; + }; + }; + }; + }; +}