This commit is contained in:
Robin Appelman 2025-06-02 21:34:58 +02:00
commit dfb6dd0b57
3 changed files with 44 additions and 45 deletions

View file

@ -1,11 +1,12 @@
{ config
, lib
, pkgs
, ...
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.services.prometheus.exporters.wifi;
format = pkgs.formats.toml { };
format = pkgs.formats.toml {};
configFile = format.generate "wifi-prometheus-exporter-config.toml" {
ssh = {
inherit (cfg.ssh) address user;
@ -20,9 +21,7 @@ with lib; let
password_file = "$CREDENTIALS_DIRECTORY/mqtt_password";
};
};
in
{
in {
options.services.prometheus.exporters.wifi = {
enable = mkEnableOption "WiFi prometheus exporter";
@ -99,7 +98,7 @@ in
config = mkIf cfg.enable {
systemd.services."wifi-prometheus-exporter" = {
wantedBy = [ "multi-user.target" ];
wantedBy = ["multi-user.target"];
environment = {
RUST_LOG = cfg.log;
};
@ -133,9 +132,9 @@ in
RestrictAddressFamilies = "AF_INET AF_INET6";
RestrictRealtime = true;
ProtectProc = "noaccess";
SystemCallFilter = [ "@system-service" "~@resources" "~@privileged" ];
SystemCallFilter = ["@system-service" "~@resources" "~@privileged"];
IPAddressDeny = "any";
IPAddressAllow = [ "192.168.0.0/16" "localhost" ];
IPAddressAllow = ["192.168.0.0/16" "localhost"];
PrivateUsers = true;
ProcSubset = "pid";
};