diff options
author | Ryan Mulligan <ryan@ryantm.com> | 2018-11-09 16:07:42 -0800 |
---|---|---|
committer | Ryan Mulligan <ryan@ryantm.com> | 2018-11-09 16:07:42 -0800 |
commit | 8d0b95dc09f9aa6d75378d3375d98785cbca5e3f (patch) | |
tree | 417bb38797aa3e85e837f0f43fc010f7cbdf4bc8 /nixos/modules/services/monitoring/monit.nix | |
parent | feb92ef7d3f9129038e277fd4c0cc9f5df440887 (diff) | |
download | nixlib-8d0b95dc09f9aa6d75378d3375d98785cbca5e3f.tar nixlib-8d0b95dc09f9aa6d75378d3375d98785cbca5e3f.tar.gz nixlib-8d0b95dc09f9aa6d75378d3375d98785cbca5e3f.tar.bz2 nixlib-8d0b95dc09f9aa6d75378d3375d98785cbca5e3f.tar.lz nixlib-8d0b95dc09f9aa6d75378d3375d98785cbca5e3f.tar.xz nixlib-8d0b95dc09f9aa6d75378d3375d98785cbca5e3f.tar.zst nixlib-8d0b95dc09f9aa6d75378d3375d98785cbca5e3f.zip |
nixos/monit: change type of 'config' option to lines
By using types.lines for 'config', we can specify monit configurations in lots of modules and they can all be automatically combined together with newlines. This is desireable because different modules might want to each specify the small monitoring task specific to their service. This commit also updates the module to use current idioms.
Diffstat (limited to 'nixos/modules/services/monitoring/monit.nix')
-rw-r--r-- | nixos/modules/services/monitoring/monit.nix | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/nixos/modules/services/monitoring/monit.nix b/nixos/modules/services/monitoring/monit.nix index d48e5c550abb..32e14ab21ffc 100644 --- a/nixos/modules/services/monitoring/monit.nix +++ b/nixos/modules/services/monitoring/monit.nix @@ -1,33 +1,30 @@ -# Monit system watcher -# http://mmonit.org/monit/ - {config, pkgs, lib, ...}: -let inherit (lib) mkOption mkIf; +with lib; + +let + cfg = config.services.monit; in { - options = { - services.monit = { - enable = mkOption { - default = false; - description = '' - Whether to run Monit system watcher. - ''; - }; - config = mkOption { - default = ""; - description = "monitrc content"; - }; + options.services.monit = { + + enable = mkEnableOption "Monit"; + + config = mkOption { + type = types.lines; + default = ""; + description = "monitrc content"; }; + }; - config = mkIf config.services.monit.enable { + config = mkIf cfg.enable { environment.systemPackages = [ pkgs.monit ]; environment.etc."monitrc" = { - text = config.services.monit.config; + text = cfg.config; mode = "0400"; }; |