nixos/monit: install monit as system package, use default config file path

This commit is contained in:
Ryan Mulligan 2017-09-27 15:20:14 -07:00 committed by Franz Pletz
parent 46b0bca808
commit c6f513b56a

View file

@ -17,20 +17,22 @@ in
}; };
config = mkOption { config = mkOption {
default = ""; default = "";
description = "monit.conf content"; description = "monitrc content";
}; };
}; };
}; };
config = mkIf config.services.monit.enable { config = mkIf config.services.monit.enable {
environment.systemPackages = [ pkgs.monit ];
environment.etc = [ environment.etc = [
{ {
source = pkgs.writeTextFile { source = pkgs.writeTextFile {
name = "monit.conf"; name = "monitrc";
text = config.services.monit.config; text = config.services.monit.config;
}; };
target = "monit.conf"; target = "monitrc";
mode = "0400"; mode = "0400";
} }
]; ];
@ -40,9 +42,9 @@ in
after = [ "network.target" ]; after = [ "network.target" ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
serviceConfig = { serviceConfig = {
ExecStart = "${pkgs.monit}/bin/monit -I -c /etc/monit.conf"; ExecStart = "${pkgs.monit}/bin/monit -I -c /etc/monitrc";
ExecStop = "${pkgs.monit}/bin/monit -c /etc/monit.conf quit"; ExecStop = "${pkgs.monit}/bin/monit -c /etc/monitrc quit";
ExecReload = "${pkgs.monit}/bin/monit -c /etc/monit.conf reload"; ExecReload = "${pkgs.monit}/bin/monit -c /etc/monitrc reload";
KillMode = "process"; KillMode = "process";
Restart = "always"; Restart = "always";
}; };