nixos/unifi-poller: rename to unpoller.

This commit is contained in:
Luke Granger-Brown 2022-11-24 15:30:14 +00:00
parent 40ddf3e2c6
commit ffcd97b521
2 changed files with 16 additions and 12 deletions

View file

@ -724,7 +724,7 @@
./services/monitoring/thanos.nix ./services/monitoring/thanos.nix
./services/monitoring/tremor-rs.nix ./services/monitoring/tremor-rs.nix
./services/monitoring/tuptime.nix ./services/monitoring/tuptime.nix
./services/monitoring/unifi-poller.nix ./services/monitoring/unpoller.nix
./services/monitoring/ups.nix ./services/monitoring/ups.nix
./services/monitoring/uptime.nix ./services/monitoring/uptime.nix
./services/monitoring/vmagent.nix ./services/monitoring/vmagent.nix

View file

@ -3,15 +3,19 @@
with lib; with lib;
let let
cfg = config.services.unifi-poller; cfg = config.services.unpoller;
configFile = pkgs.writeText "unifi-poller.json" (generators.toJSON {} { configFile = pkgs.writeText "unpoller.json" (generators.toJSON {} {
inherit (cfg) poller influxdb loki prometheus unifi; inherit (cfg) poller influxdb loki prometheus unifi;
}); });
in { in {
options.services.unifi-poller = { imports = [
enable = mkEnableOption (lib.mdDoc "unifi-poller"); (lib.mkRenamedOptionModule [ "services" "unifi-poller" ] [ "services" "unpoller" ])
];
options.services.unpoller = {
enable = mkEnableOption (lib.mdDoc "unpoller");
poller = { poller = {
debug = mkOption { debug = mkOption {
@ -86,8 +90,8 @@ in {
}; };
pass = mkOption { pass = mkOption {
type = types.path; type = types.path;
default = pkgs.writeText "unifi-poller-influxdb-default.password" "unifipoller"; default = pkgs.writeText "unpoller-influxdb-default.password" "unifipoller";
defaultText = literalExpression "unifi-poller-influxdb-default.password"; defaultText = literalExpression "unpoller-influxdb-default.password";
description = lib.mdDoc '' description = lib.mdDoc ''
Path of a file containing the password for influxdb. Path of a file containing the password for influxdb.
This file needs to be readable by the unifi-poller user. This file needs to be readable by the unifi-poller user.
@ -135,8 +139,8 @@ in {
}; };
pass = mkOption { pass = mkOption {
type = types.path; type = types.path;
default = pkgs.writeText "unifi-poller-loki-default.password" ""; default = pkgs.writeText "unpoller-loki-default.password" "";
defaultText = "unifi-poller-influxdb-default.password"; defaultText = "unpoller-influxdb-default.password";
description = lib.mdDoc '' description = lib.mdDoc ''
Path of a file containing the password for Loki. Path of a file containing the password for Loki.
This file needs to be readable by the unifi-poller user. This file needs to be readable by the unifi-poller user.
@ -184,8 +188,8 @@ in {
}; };
pass = mkOption { pass = mkOption {
type = types.path; type = types.path;
default = pkgs.writeText "unifi-poller-unifi-default.password" "unifi"; default = pkgs.writeText "unpoller-unifi-default.password" "unifi";
defaultText = literalExpression "unifi-poller-unifi-default.password"; defaultText = literalExpression "unpoller-unifi-default.password";
description = lib.mdDoc '' description = lib.mdDoc ''
Path of a file containing the password for the unifi service user. Path of a file containing the password for the unifi service user.
This file needs to be readable by the unifi-poller user. This file needs to be readable by the unifi-poller user.
@ -303,7 +307,7 @@ in {
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
after = [ "network.target" ]; after = [ "network.target" ];
serviceConfig = { serviceConfig = {
ExecStart = "${pkgs.unifi-poller}/bin/unifi-poller --config ${configFile}"; ExecStart = "${pkgs.unpoller}/bin/unpoller --config ${configFile}";
Restart = "always"; Restart = "always";
PrivateTmp = true; PrivateTmp = true;
ProtectHome = true; ProtectHome = true;