mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-23 05:37:27 +03:00
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.
This commit is contained in:
parent
feb92ef7d3
commit
8d0b95dc09
@ -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";
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user