nixos-config/modules/prometheus/smartctl_exporter.nix

23 lines
689 B
Nix

# SPDX-FileCopyrightText: 2020-2024 Simon Bruder <simon@sbruder.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
{ config, lib, ... }:
{
services.prometheus.exporters.smartctl = {
enable = config.sbruder.wireguard.home.enable && !config.sbruder.machine.isVm;
listenAddress = config.sbruder.wireguard.home.address;
# devices need to be specified for all systems that use NVMe
# https://github.com/NixOS/nixpkgs/issues/210041
};
systemd.services.prometheus-smartctl-exporter = {
after = [ "wireguard-wg-home.service" ];
serviceConfig = {
IPAddressAllow = lib.singleton config.sbruder.wireguard.home.subnet;
IPAddressDeny = "any";
};
};
}