Convert "postfix"
svn path=/nixos/branches/fix-style/; revision=14392
This commit is contained in:
parent
e5fd3f271e
commit
32ec389b15
@ -479,144 +479,6 @@ in
|
||||
|
||||
};
|
||||
|
||||
postfix = {
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
description ="
|
||||
Whether to run the Postfix mail server.
|
||||
";
|
||||
};
|
||||
user = mkOption {
|
||||
default = "postfix";
|
||||
description = "
|
||||
How to call postfix user (must be used only for postfix).
|
||||
";
|
||||
};
|
||||
group = mkOption {
|
||||
default = "postfix";
|
||||
description = "
|
||||
How to call postfix group (must be used only for postfix).
|
||||
";
|
||||
};
|
||||
setgidGroup = mkOption {
|
||||
default = "postdrop";
|
||||
description = "
|
||||
How to call postfix setgid group (for postdrop). Should
|
||||
be uniquely used group.
|
||||
";
|
||||
};
|
||||
networks = mkOption {
|
||||
default = null;
|
||||
example = ["192.168.0.1/24"];
|
||||
description = "
|
||||
Net masks for trusted - allowed to relay mail to third parties -
|
||||
hosts. Leave empty to use mynetworks_style configuration or use
|
||||
default (localhost-only).
|
||||
";
|
||||
};
|
||||
networksStyle = mkOption {
|
||||
default = "";
|
||||
description = "
|
||||
Name of standard way of trusted network specification to use,
|
||||
leave blank if you specify it explicitly or if you want to use
|
||||
default (localhost-only).
|
||||
";
|
||||
};
|
||||
hostname = mkOption {
|
||||
default = "";
|
||||
description ="
|
||||
Hostname to use. Leave blank to use just the hostname of machine.
|
||||
It should be FQDN.
|
||||
";
|
||||
};
|
||||
domain = mkOption {
|
||||
default = "";
|
||||
description ="
|
||||
Domain to use. Leave blank to use hostname minus first component.
|
||||
";
|
||||
};
|
||||
origin = mkOption {
|
||||
default = "";
|
||||
description ="
|
||||
Origin to use in outgoing e-mail. Leave blank to use hostname.
|
||||
";
|
||||
};
|
||||
destination = mkOption {
|
||||
default = null;
|
||||
example = ["localhost"];
|
||||
description = "
|
||||
Full (!) list of domains we deliver locally. Leave blank for
|
||||
acceptable Postfix default.
|
||||
";
|
||||
};
|
||||
relayDomains = mkOption {
|
||||
default = null;
|
||||
example = ["localdomain"];
|
||||
description = "
|
||||
List of domains we agree to relay to. Default is the same as
|
||||
destination.
|
||||
";
|
||||
};
|
||||
relayHost = mkOption {
|
||||
default = "";
|
||||
description = "
|
||||
Mail relay for outbound mail.
|
||||
";
|
||||
};
|
||||
lookupMX = mkOption {
|
||||
default = false;
|
||||
description = "
|
||||
Whether relay specified is just domain whose MX must be used.
|
||||
";
|
||||
};
|
||||
postmasterAlias = mkOption {
|
||||
default = "root";
|
||||
description = "
|
||||
Who should receive postmaster e-mail.
|
||||
";
|
||||
};
|
||||
rootAlias = mkOption {
|
||||
default = "";
|
||||
description = "
|
||||
Who should receive root e-mail. Blank for no redirection.
|
||||
";
|
||||
};
|
||||
extraAliases = mkOption {
|
||||
default = "";
|
||||
description = "
|
||||
Additional entries to put verbatim into aliases file.
|
||||
";
|
||||
};
|
||||
|
||||
sslCert = mkOption {
|
||||
default = "";
|
||||
description = "
|
||||
SSL certificate to use.
|
||||
";
|
||||
};
|
||||
sslCACert = mkOption {
|
||||
default = "";
|
||||
description = "
|
||||
SSL certificate of CA.
|
||||
";
|
||||
};
|
||||
sslKey = mkOption {
|
||||
default = "";
|
||||
description ="
|
||||
SSL key to use.
|
||||
";
|
||||
};
|
||||
|
||||
recipientDelimiter = mkOption {
|
||||
default = "";
|
||||
example = "+";
|
||||
description = "
|
||||
Delimiter for address extension: so mail to user+test can be handled by ~user/.forward+test
|
||||
";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
dovecot = {
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
@ -784,6 +646,7 @@ in
|
||||
(import ../upstart-jobs/mysql.nix)
|
||||
(import ../upstart-jobs/postgresql.nix)
|
||||
(import ../upstart-jobs/openfire.nix)
|
||||
(import ../upstart-jobs/postfix.nix)
|
||||
|
||||
# nix
|
||||
(import ../upstart-jobs/nix.nix) # nix options and daemon
|
||||
|
@ -131,12 +131,6 @@ let
|
||||
inherit config;
|
||||
})
|
||||
|
||||
# Postfix mail server.
|
||||
++ optional config.services.postfix.enable
|
||||
(import ../upstart-jobs/postfix.nix {
|
||||
inherit config pkgs;
|
||||
})
|
||||
|
||||
# Dovecot POP3/IMAP server.
|
||||
++ optional config.services.dovecot.enable
|
||||
(import ../upstart-jobs/dovecot.nix {
|
||||
|
@ -1,4 +1,154 @@
|
||||
{config, pkgs} :
|
||||
{pkgs, config, ...}:
|
||||
|
||||
###### interface
|
||||
let
|
||||
inherit (pkgs.lib) mkOption mkIf;
|
||||
|
||||
options = {
|
||||
services = {
|
||||
postfix = {
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
description ="
|
||||
Whether to run the Postfix mail server.
|
||||
";
|
||||
};
|
||||
user = mkOption {
|
||||
default = "postfix";
|
||||
description = "
|
||||
How to call postfix user (must be used only for postfix).
|
||||
";
|
||||
};
|
||||
group = mkOption {
|
||||
default = "postfix";
|
||||
description = "
|
||||
How to call postfix group (must be used only for postfix).
|
||||
";
|
||||
};
|
||||
setgidGroup = mkOption {
|
||||
default = "postdrop";
|
||||
description = "
|
||||
How to call postfix setgid group (for postdrop). Should
|
||||
be uniquely used group.
|
||||
";
|
||||
};
|
||||
networks = mkOption {
|
||||
default = null;
|
||||
example = ["192.168.0.1/24"];
|
||||
description = "
|
||||
Net masks for trusted - allowed to relay mail to third parties -
|
||||
hosts. Leave empty to use mynetworks_style configuration or use
|
||||
default (localhost-only).
|
||||
";
|
||||
};
|
||||
networksStyle = mkOption {
|
||||
default = "";
|
||||
description = "
|
||||
Name of standard way of trusted network specification to use,
|
||||
leave blank if you specify it explicitly or if you want to use
|
||||
default (localhost-only).
|
||||
";
|
||||
};
|
||||
hostname = mkOption {
|
||||
default = "";
|
||||
description ="
|
||||
Hostname to use. Leave blank to use just the hostname of machine.
|
||||
It should be FQDN.
|
||||
";
|
||||
};
|
||||
domain = mkOption {
|
||||
default = "";
|
||||
description ="
|
||||
Domain to use. Leave blank to use hostname minus first component.
|
||||
";
|
||||
};
|
||||
origin = mkOption {
|
||||
default = "";
|
||||
description ="
|
||||
Origin to use in outgoing e-mail. Leave blank to use hostname.
|
||||
";
|
||||
};
|
||||
destination = mkOption {
|
||||
default = null;
|
||||
example = ["localhost"];
|
||||
description = "
|
||||
Full (!) list of domains we deliver locally. Leave blank for
|
||||
acceptable Postfix default.
|
||||
";
|
||||
};
|
||||
relayDomains = mkOption {
|
||||
default = null;
|
||||
example = ["localdomain"];
|
||||
description = "
|
||||
List of domains we agree to relay to. Default is the same as
|
||||
destination.
|
||||
";
|
||||
};
|
||||
relayHost = mkOption {
|
||||
default = "";
|
||||
description = "
|
||||
Mail relay for outbound mail.
|
||||
";
|
||||
};
|
||||
lookupMX = mkOption {
|
||||
default = false;
|
||||
description = "
|
||||
Whether relay specified is just domain whose MX must be used.
|
||||
";
|
||||
};
|
||||
postmasterAlias = mkOption {
|
||||
default = "root";
|
||||
description = "
|
||||
Who should receive postmaster e-mail.
|
||||
";
|
||||
};
|
||||
rootAlias = mkOption {
|
||||
default = "";
|
||||
description = "
|
||||
Who should receive root e-mail. Blank for no redirection.
|
||||
";
|
||||
};
|
||||
extraAliases = mkOption {
|
||||
default = "";
|
||||
description = "
|
||||
Additional entries to put verbatim into aliases file.
|
||||
";
|
||||
};
|
||||
|
||||
sslCert = mkOption {
|
||||
default = "";
|
||||
description = "
|
||||
SSL certificate to use.
|
||||
";
|
||||
};
|
||||
sslCACert = mkOption {
|
||||
default = "";
|
||||
description = "
|
||||
SSL certificate of CA.
|
||||
";
|
||||
};
|
||||
sslKey = mkOption {
|
||||
default = "";
|
||||
description ="
|
||||
SSL key to use.
|
||||
";
|
||||
};
|
||||
|
||||
recipientDelimiter = mkOption {
|
||||
default = "";
|
||||
example = "+";
|
||||
description = "
|
||||
Delimiter for address extension: so mail to user+test can be handled by ~user/.forward+test
|
||||
";
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
|
||||
###### implementation
|
||||
|
||||
let
|
||||
startingDependency = if config.services.gw6c.enable then "gw6c" else "network-interfaces";
|
||||
|
||||
@ -103,9 +253,21 @@ let
|
||||
mainCfFile = pkgs.writeText "postfix-main.cf" mainCf;
|
||||
|
||||
in
|
||||
{
|
||||
name = "postfix";
|
||||
users = [
|
||||
|
||||
mkIf config.services.postfix.enable {
|
||||
require = [
|
||||
options
|
||||
];
|
||||
|
||||
environment = {
|
||||
etc = [{
|
||||
source = "/var/postfix/conf";
|
||||
target = "postfix";
|
||||
}];
|
||||
};
|
||||
|
||||
users = {
|
||||
extraUsers = [
|
||||
{ name = user;
|
||||
description = "Postfix mail server user";
|
||||
uid = idList.uids.postfix;
|
||||
@ -113,7 +275,7 @@ in
|
||||
}
|
||||
];
|
||||
|
||||
groups = [
|
||||
extraGroups = [
|
||||
{ name = group;
|
||||
gid = idList.gids.postfix;
|
||||
}
|
||||
@ -121,6 +283,11 @@ in
|
||||
gid = idList.gids.postdrop;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
services = {
|
||||
extraJobs = [{
|
||||
name = "postfix";
|
||||
|
||||
|
||||
# I copy _lots_ of shipped configuration filed
|
||||
@ -156,9 +323,6 @@ in
|
||||
end script
|
||||
'';
|
||||
|
||||
extraEtc = [
|
||||
{ source = "/var/postfix/conf";
|
||||
target = "postfix";
|
||||
}
|
||||
];
|
||||
}];
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user