nixos-config/modules/prometheus/smartctl_exporter.nix

23 lines
705 B
Nix
Raw Normal View History

2024-05-25 16:13:03 +02:00
# SPDX-FileCopyrightText: 2020-2024 Simon Bruder <simon@sbruder.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
{ config, lib, ... }:
2024-07-19 12:00:15 +02:00
lib.mkIf (config.sbruder.wireguard.home.enable && !config.sbruder.machine.isVm) {
2024-05-25 16:13:03 +02:00
services.prometheus.exporters.smartctl = {
2024-07-19 12:00:15 +02:00
enable = true;
2024-05-25 16:13:03 +02:00
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";
};
};
}