mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-24 20:02:58 +03:00
Merge pull request #87553 from JoeDupuis/enhancing-monit-module
nixos/monit: Allow splitting the config in multiple files
This commit is contained in:
commit
2fb9ee9caa
@ -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 {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = "monitrc content";
|
||||
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 = "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";
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user