diff options
author | Lassulus <github@lassul.us> | 2020-08-22 19:21:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-22 19:21:55 +0200 |
commit | 2fb9ee9caa4cd7359ba28ec147646d67189218ac (patch) | |
tree | 1d24a3e0692419995e6b52eed15473dd626f484a /nixos | |
parent | ecaebb0ec6cc732bffc949f5b541bbece91fa654 (diff) | |
parent | 8f4070c4c6a48a5360ecfa6f803e36dfc3ca822c (diff) | |
download | nixpkgs-2fb9ee9caa4cd7359ba28ec147646d67189218ac.tar nixpkgs-2fb9ee9caa4cd7359ba28ec147646d67189218ac.tar.gz nixpkgs-2fb9ee9caa4cd7359ba28ec147646d67189218ac.tar.bz2 nixpkgs-2fb9ee9caa4cd7359ba28ec147646d67189218ac.tar.lz nixpkgs-2fb9ee9caa4cd7359ba28ec147646d67189218ac.tar.xz nixpkgs-2fb9ee9caa4cd7359ba28ec147646d67189218ac.tar.zst nixpkgs-2fb9ee9caa4cd7359ba28ec147646d67189218ac.zip |
Merge pull request #87553 from JoeDupuis/enhancing-monit-module
nixos/monit: Allow splitting the config in multiple files
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/monitoring/monit.nix | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/nixos/modules/services/monitoring/monit.nix b/nixos/modules/services/monitoring/monit.nix index ca935227217..aa51b83912c 100644 --- a/nixos/modules/services/monitoring/monit.nix +++ b/nixos/modules/services/monitoring/monit.nix @@ -4,19 +4,29 @@ with lib; let cfg = config.services.monit; + extraConfig = pkgs.writeText "monitConfig" cfg.extraConfig; in { + imports = [ + (mkRenamedOptionModule [ "services" "monit" "config" ] ["services" "monit" "extraConfig" ]) + ]; + options.services.monit = { enable = mkEnableOption "Monit"; - config = mkOption { + configFiles = mkOption { + type = types.listOf types.path; + default = []; + description = "List of paths to be included in the monitrc file"; + }; + + extraConfig = mkOption { type = types.lines; default = ""; - description = "monitrc content"; + description = "Additional monit config as string"; }; - }; config = mkIf cfg.enable { @@ -24,7 +34,7 @@ in environment.systemPackages = [ pkgs.monit ]; environment.etc.monitrc = { - text = cfg.config; + text = concatMapStringsSep "\n" (path: "include ${path}") (cfg.configFiles ++ [extraConfig]); mode = "0400"; }; |