diff --git a/nixos/modules/services/monitoring/nagios.nix b/nixos/modules/services/monitoring/nagios.nix
index 7f65236ed3d..6a3b9776946 100644
--- a/nixos/modules/services/monitoring/nagios.nix
+++ b/nixos/modules/services/monitoring/nagios.nix
@@ -36,7 +36,7 @@ let
# Uid/gid that the daemon runs under.
nagios_user=nagios
- nagios_group=nogroup
+ nagios_group=nagios
# Misc. options.
illegal_macro_output_chars=`~$&|'"<>
@@ -58,9 +58,7 @@ let
Options ExecCGI
- AllowOverride None
- Order allow,deny
- Allow from all
+ Require all granted
SetEnv NAGIOS_CGI_CONFIG ${cfg.cgiConfigFile}
@@ -68,9 +66,7 @@ let
Options None
- AllowOverride None
- Order allow,deny
- Allow from all
+ Require all granted
'';
@@ -149,9 +145,11 @@ in
description = "Nagios user ";
uid = config.ids.uids.nagios;
home = nagiosState;
- createHome = true;
+ group = "nagios";
};
+ users.groups.nagios = { };
+
# This isn't needed, it's just so that the user can type "nagiostats
# -c /etc/nagios.cfg".
environment.etc = [
@@ -169,16 +167,13 @@ in
serviceConfig = {
User = "nagios";
+ Group = "nagios";
Restart = "always";
RestartSec = 2;
- PermissionsStartOnly = true;
+ LogsDirectory = "nagios";
+ StateDirectory = "nagios";
};
- preStart = ''
- mkdir -m 0755 -p ${nagiosState} ${nagiosLogDir}
- chown nagios ${nagiosState} ${nagiosLogDir}
- '';
-
script = ''
for i in ${toString cfg.plugins}; do
export PATH=$i/bin:$i/sbin:$i/libexec:$PATH