Nixpkgs version
Describe the bug
When systemd is starting exim i'm getting this error:
× exim.service - Exim Mail Daemon
Loaded: loaded (/etc/systemd/system/exim.service; enabled; preset: ignored)
Active: failed (Result: exit-code) since Thu 2025-02-27 10:49:41 CET; 282ms ago
Invocation: 521769a7c6c14a84ba571aad310799be
Process: 8142 ExecStartPre=/nix/store/w1afiz8w4mdbnx9dpg8psc5jn0g9gavp-unit-script-exim-pre-start/bin/exim-pre-start (code=exited, status=1/FAILURE)
IP: 0B in, 0B out
IO: 0B read, 0B written
Mem peak: 1.6M
CPU: 10ms
Feb 27 10:49:41 bebian systemd[1]: Starting Exim Mail Daemon...
Feb 27 10:49:41 bebian exim-pre-start[8143]: /nix/store/6wgd8c9vq93mqxzc7jhkl86mv6qbc360-coreutils-9.5/bin/mkdir: cannot create directory ‘/var/spool/exim’: Permission denied
Feb 27 10:49:41 bebian systemd[1]: exim.service: Control process exited, code=exited, status=1/FAILURE
Feb 27 10:49:41 bebian systemd[1]: exim.service: Failed with result 'exit-code'.
Feb 27 10:49:41 bebian systemd[1]: Failed to start Exim Mail Daemon.
Steps to reproduce
services.exim.enable = true;
Expected behaviour
No errors.
Screenshots
No response
Relevant log output
Additional context
I think this issue is caused by the preStart shell script:
systemd.services.exim = {
description = "Exim Mail Daemon";
wantedBy = [ "multi-user.target" ];
restartTriggers = [ config.environment.etc."exim.conf".source ];
serviceConfig = {
ExecStart = "!${cfg.package}/bin/exim -bdf -q${cfg.queueRunnerInterval}";
ExecReload = "!${coreutils}/bin/kill -HUP $MAINPID";
User = cfg.user;
};
preStart = ''
if ! test -d ${cfg.spoolDir}; then
${coreutils}/bin/mkdir -p ${cfg.spoolDir}
${coreutils}/bin/chown ${cfg.user}:${cfg.group} ${cfg.spoolDir}
fi
'';
};
This script is being ran as user cfg.user which is exim by default, hence the privilege error. Also chown is redundant in this context.
System metadata
- system: `"x86_64-linux"`
- host os: `Linux 6.6.78, NixOS, 24.11 (Vicuna), 24.11.714734.8d81223bea41`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.24.12`
- channels(root): `"nixos-24.11-small"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
Notify maintainers
Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)
I assert that this issue is relevant for Nixpkgs
Is this issue important to you?
Add a 👍 reaction to issues you find important.
Nixpkgs version
Describe the bug
When systemd is starting exim i'm getting this error:
Steps to reproduce
services.exim.enable = true;Expected behaviour
No errors.
Screenshots
No response
Relevant log output
Additional context
I think this issue is caused by the preStart shell script:
This script is being ran as user cfg.user which is exim by default, hence the privilege error. Also
chownis redundant in this context.System metadata
Notify maintainers
@ajs124
@4z3
Note for maintainers: Please tag this issue in your pull request description. (i.e.
Resolves #ISSUE.)I assert that this issue is relevant for Nixpkgs
Is this issue important to you?
Add a 👍 reaction to issues you find important.