feat: add metrics exporters for Dovecot and Postfix, update Signal execution command, and improve configuration management

This commit is contained in:
2025-06-03 23:06:40 +02:00
parent 436903543b
commit e8bf13275e
10 changed files with 102 additions and 3 deletions

View File

@@ -70,6 +70,7 @@ Bento is utilized for deploying configurations across systems.
* Regularly review and refactor modules for efficiency and clarity.
* Document all modules and configurations for future reference.
* Test configurations in a controlled environment before deploying to production systems.([NixOS & Flakes][6])
* After developing a feature, delete the corresponding development plan.
---

View File

@@ -13,7 +13,7 @@
./utils/modules/borgbackup.nix
./utils/modules/promtail
./utils/modules/victoriametrics
./modules/metrics
./modules/set-nix-channel.nix # Automatically manage nix-channel from /var/bento/channel
./hardware-configuration.nix

View File

@@ -0,0 +1,8 @@
{ config, pkgs, ... }:
{
imports = [
../../utils/modules/victoriametrics/default.nix
./postfix-exporter.nix
./dovecot-exporter.nix
];
}

View File

@@ -0,0 +1,15 @@
{ config, pkgs, lib, ... }:
{
services.prometheus.exporters.dovecot = {
enable = true;
};
services.victoriametrics.extraScrapeConfigs = [
''
- job_name: "dovecot-exporter"
static_configs:
- targets: ['localhost:9166']
''
];
}

View File

@@ -0,0 +1,16 @@
{ config, pkgs, lib, ... }:
{
services.prometheus.exporters.postfix = {
enable = true;
};
services.victoriametrics.extraScrapeConfigs = [
''
- job_name: "postfix-exporter"
static_configs:
- targets: ['localhost:9154']
''
];
}

View File

@@ -6,7 +6,7 @@ let
name = "signal-work";
desktopName = "Signal with work profile";
icon = "signal-desktop";
exec = "SIGNAL_USE_HARDWARE_ACCELERATION=1 signal-desktop --enable-dev-tools --enable-features=VaapiVideoDecoder --user-data-dir=/home/dominik/.config/Signal-work -- %u";
exec = "signal-desktop --enable-dev-tools --enable-features=VaapiVideoDecoder --user-data-dir=/home/dominik/.config/Signal-work -- %u";
};
in {
environment.systemPackages = [

View File

@@ -8,6 +8,7 @@
/home/dominik/projects/cloonar/cloonar-assistant
/home/dominik/projects/cloonar/cloonar-assistant-customers
/home/dominik/projects/cloonar/updns
/home/dominik/projects/cloonar/mcp-servers-nix
/home/dominik/projects/cloonar/flow/flow-docs
/home/dominik/projects/cloonar/flow/flow-user-service

View File

@@ -604,6 +604,7 @@ in
git clone gitea@git.cloonar.com:Cloonar/cloonar-assistant.git ${persistHome}/projects/cloonar/cloonar-assistant 2>/dev/null
git clone gitea@git.cloonar.com:Cloonar/cloonar-assistant-customers.git ${persistHome}/projects/cloonar/cloonar-assistant-customers 2>/dev/null
git clone gitea@git.cloonar.com:Cloonar/updns.git ${persistHome}/projects/cloonar/updns 2>/dev/null
git clone git@github.com:dpolakovics/mcp-servers-nix.git ${persistHome}/cloonar/mcp-servers-nix 2>/dev/null
git clone gitea@git.cloonar.com:Cloonar/flow-docs.git ${persistHome}/projects/cloonar/flow/flow-docs 2>/dev/null
git clone gitea@git.cloonar.com:Cloonar/flow-user-service.git ${persistHome}/projects/cloonar/flow/flow-user-service 2>/dev/null

57
shell.nix Normal file
View File

@@ -0,0 +1,57 @@
with import <nixpkgs> { };
let
# 1. Import mcp-servers-nix (classic default.nix) from GitHub.
# This provides `mcpServers.lib.mkConfig` and the individual server packages.
mcpServers = import (builtins.fetchTarball {
url = "https://github.com/natsukium/mcp-servers-nix/archive/refs/heads/main.tar.gz";
# Optionally pin with sha256 once known.
}) { inherit pkgs; };
# 3. Build the JSON configuration string with exactly fetch, memory, and brave-search.
# We assume you store your Brave Search API key in "~/.config/mcp-servers/brave.env"
mcpConfig = mcpServers.lib.mkConfig pkgs {
programs = {
# fetch.enable = true;
filesystem = {
enable = true;
args = [ "/home/${builtins.getEnv "USER"}/projects/cloonar/cloonar-nixos/" ];
};
git = {
enable = true;
args = [ "/home/${builtins.getEnv "USER"}/projects/cloonar/cloonar-nixos/" ];
};
sequential-thinking.enable = true;
# memory.enable = true;
"brave-search" = {
enable = true;
envFile = "/home/${builtins.getEnv "USER"}/.config/mcp-servers/brave.env";
};
};
settings = {
mcpServers = {
nixos = {
command = "nix";
args = ["run" "github:utensils/mcp-nixos" "--"];
};
};
};
};
in
pkgs.mkShell {
# 4. Bring in 'jq' so you can inspect the JSON if needed.
buildInputs = [ pkgs.jq ];
# 5. On shell entry, write out 'claude_desktop_config.json' in the project root.
shellHook = ''
if [ -f ./.roo/mcp.json ]; then
echo "Removing old mcp.json"
rm ./.roo/mcp.json
fi
echo "Generating mcp.json"
ln -s ${builtins.toString mcpConfig} ./.roo/mcp.json
echo " mcp.json has been created."
'';
}

View File

@@ -30,7 +30,7 @@ let
regex: '(container@git|microvm@git-runner-|postfix|dovecot|openldap|wireguard-wg_cloonar).*\.service'
action: keep
${concatStringsSep "\n " config.services.victoriametrics.extraScrapeConfigs}
${concatStringsSep "\n" config.services.victoriametrics.extraScrapeConfigs}
'';
in {
options.services.victoriametrics = {