I’m trying to setup postscreen in Postfix. Since there are no Nix options for this, I have to modify the Postfix-master.cf.
How can I do this?
I’ve tried several ways, but none worked:
services.postfix.masterConfig. = … can only (a) add entries or (b) add parameters to existing entries. If I try to overwrite an already existing parameter in an entry, I get the error:
error: The unique option services.postfix.masterConfig.smtp_inet.command' is defined multiple times, in /etc/nixos/configuration.nix’ and `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/services/mail/postfix.nix’.
So, how can I overwrite/modify this entry? Or remove the original entry?
(In detail, I would like to: masterConfig.smtp_inet = { maxproc=1; chroot=false; command="postscreen"; };
Setting service.postfix.masterConfig also only adds values, but cannot replace the default ones.
(And adding an additional smtp-postscreen-entry does not work.)
services.extraMasterConfig also can only add entries, but not modify others.
Using a custom master.cf: Seems impossible.
So, is there any way? Or would I have to fix the Postfix package??
You don’t have to prepend pkgs., however I don’t know your configuration so I can only guess that lib is missing in your module arguments, so you need to add it like so:
This will lead to an infinite recursion error, because the pkgs module argument actually is a configuration option itself (_module.args.pkgs) which can only be resolved once all modules are determined. In this case it can’t do so because importing the /some/file.nix module would depend on that option (which could even be redefined in /some/file.nix).
Ok, thanks, then I’ll replace the default { config, pkgs, ... }: by { config, pkgs, lib, ... }: at the top of /etc/nixos/configuration.nix. NixOS unfortunately does not include this by default.