added new command line interface
This commit is contained in:
@ -8,9 +8,6 @@ inputs: {
|
||||
cfg = config.outage-detector;
|
||||
package = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
||||
inherit (lib) mkIf mkEnableOption mkOption types;
|
||||
|
||||
format = pkgs.formats.json {};
|
||||
configFile = format.generate "config.json" cfg.settings;
|
||||
in {
|
||||
options.outage-detector = {
|
||||
enable = mkEnableOption "outage-detector";
|
||||
@ -37,7 +34,11 @@ in {
|
||||
]);
|
||||
in
|
||||
valueType;
|
||||
default = throw "Please specify outage-detector.settings";
|
||||
default = {
|
||||
filename = throw "Please specify outage-detector.settings.";
|
||||
host = "1.1.1.1";
|
||||
timeout = 2;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@ -46,7 +47,7 @@ in {
|
||||
|
||||
systemd.services.outage-detector = mkIf (cfg.timer
|
||||
!= null) {
|
||||
script = "${package}/bin/outage_detector --config ${configFile}";
|
||||
script = "${package}/bin/outage_detector log ${cfg.settings.filename} --host ${cfg.settings.host} --timeout ${cfg.settings.timeout}";
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
|
Reference in New Issue
Block a user