mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-20 04:19:00 +02:00
Merge pull request #296463 from MinerSebas/scrutiny-split
This commit is contained in:
commit
bfa0fb2dbe
|
@ -2,7 +2,7 @@
|
||||||
let
|
let
|
||||||
inherit (lib) maintainers;
|
inherit (lib) maintainers;
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.options) literalExpression mkEnableOption mkOption mkPackageOption;
|
inherit (lib.options) literalExpression mkEnableOption mkOption mkPackageOption;
|
||||||
inherit (lib.types) bool enum nullOr port str submodule;
|
inherit (lib.types) bool enum nullOr port str submodule;
|
||||||
|
|
||||||
|
@ -156,27 +156,19 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf (cfg.enable || cfg.collector.enable) {
|
config = mkMerge [
|
||||||
|
(mkIf cfg.enable {
|
||||||
services.influxdb2.enable = cfg.influxdb.enable;
|
services.influxdb2.enable = cfg.influxdb.enable;
|
||||||
|
|
||||||
networking.firewall = mkIf cfg.openFirewall {
|
networking.firewall = mkIf cfg.openFirewall {
|
||||||
allowedTCPPorts = [ cfg.settings.web.listen.port ];
|
allowedTCPPorts = [ cfg.settings.web.listen.port ];
|
||||||
};
|
};
|
||||||
|
|
||||||
services.smartd = mkIf cfg.collector.enable {
|
systemd.services.scrutiny = {
|
||||||
enable = true;
|
|
||||||
extraOptions = [
|
|
||||||
"-A /var/log/smartd/"
|
|
||||||
"--interval=600"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd = {
|
|
||||||
services = {
|
|
||||||
scrutiny = mkIf cfg.enable {
|
|
||||||
description = "Hard Drive S.M.A.R.T Monitoring, Historical Trends & Real World Failure Thresholds";
|
description = "Hard Drive S.M.A.R.T Monitoring, Historical Trends & Real World Failure Thresholds";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ] ++ lib.optional cfg.influxdb.enable "influxdb2.service";
|
||||||
|
wants = lib.optional cfg.influxdb.enable "influxdb2.service";
|
||||||
environment = {
|
environment = {
|
||||||
SCRUTINY_VERSION = "1";
|
SCRUTINY_VERSION = "1";
|
||||||
SCRUTINY_WEB_DATABASE_LOCATION = "/var/lib/scrutiny/scrutiny.db";
|
SCRUTINY_WEB_DATABASE_LOCATION = "/var/lib/scrutiny/scrutiny.db";
|
||||||
|
@ -190,8 +182,18 @@ in
|
||||||
StateDirectoryMode = "0750";
|
StateDirectoryMode = "0750";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
})
|
||||||
|
(mkIf cfg.collector.enable {
|
||||||
|
services.smartd = {
|
||||||
|
enable = true;
|
||||||
|
extraOptions = [
|
||||||
|
"-A /var/log/smartd/"
|
||||||
|
"--interval=600"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
scrutiny-collector = mkIf cfg.collector.enable {
|
systemd = {
|
||||||
|
services.scrutiny-collector = {
|
||||||
description = "Scrutiny Collector Service";
|
description = "Scrutiny Collector Service";
|
||||||
environment = {
|
environment = {
|
||||||
COLLECTOR_VERSION = "1";
|
COLLECTOR_VERSION = "1";
|
||||||
|
@ -203,13 +205,11 @@ in
|
||||||
};
|
};
|
||||||
startAt = cfg.collector.schedule;
|
startAt = cfg.collector.schedule;
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
timers = mkIf cfg.collector.enable {
|
timers.scrutiny-collector.timerConfig.Persistent = true;
|
||||||
scrutiny-collector.timerConfig.Persistent = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
meta.maintainers = [ maintainers.jnsgruk ];
|
meta.maintainers = [ maintainers.jnsgruk ];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue