From 59c4035e58e0ff224bee2f20c0f6811a71a7806f Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Tue, 24 Dec 2019 22:19:05 +0000 Subject: [PATCH] nixos/spamassassin: allow initPreConf to be a path Supporting a path here is important because it allows e.g. fetching a configuration from a URL. To do this and provide the configuration as a string, IFD would be necessary. It's just written into a path anyway. --- nixos/modules/services/mail/spamassassin.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/mail/spamassassin.nix b/nixos/modules/services/mail/spamassassin.nix index 107280f7c149..07b3bf0420aa 100644 --- a/nixos/modules/services/mail/spamassassin.nix +++ b/nixos/modules/services/mail/spamassassin.nix @@ -5,7 +5,6 @@ with lib; let cfg = config.services.spamassassin; spamassassin-local-cf = pkgs.writeText "local.cf" cfg.config; - spamassassin-init-pre = pkgs.writeText "init.pre" cfg.initPreConf; spamdEnv = pkgs.buildEnv { name = "spamd-env"; @@ -65,8 +64,9 @@ in }; initPreConf = mkOption { - type = types.str; + type = with types; either str path; description = "The SpamAssassin init.pre config."; + apply = val: if builtins.isPath val then val else pkgs.writeText "init.pre" val; default = '' #