* Options for configuring the (mail) domain.

svn path=/nixos/trunk/; revision=9785
This commit is contained in:
Eelco Dolstra 2007-11-23 17:12:37 +00:00
parent e7e685e4ce
commit 9dd7891820
4 changed files with 38 additions and 23 deletions

View file

@ -134,10 +134,11 @@ import ../helpers/make-etc.nix {
# Configuration for ssmtp.
++ optional config.networking.defaultMailServer.directDelivery {
source = pkgs.writeText "ssmtp.conf" "
mailhub=${config.networking.defaultMailServer.hostName}
UseTLS=${if config.networking.defaultMailServer.useTLS then "YES" else "NO"}
UseSTARTTLS=${if config.networking.defaultMailServer.useSTARTTLS then "YES" else "NO"}
source = let cfg = config.networking.defaultMailServer; in pkgs.writeText "ssmtp.conf" "
mailhub=${cfg.hostName}
${if cfg.domain != "" then "rewriteDomain=${cfg.domain}" else ""}
UseTLS=${if cfg.useTLS then "YES" else "NO"}
UseSTARTTLS=${if cfg.useSTARTTLS then "YES" else "NO"}
#Debug=YES
";
target = "ssmtp/ssmtp.conf";

View file

@ -265,6 +265,14 @@
";
};
domain = mkOption {
default = "";
example = "home";
description = "
The domain. It can be left empty if it is auto-detected through DHCP.
";
};
enableIntel2200BGFirmware = mkOption {
default = false;
description = "
@ -335,6 +343,14 @@
";
};
domain = mkOption {
default = "";
example = "example.org";
description = "
The domain from which mail will appear to be sent.
";
};
useTLS = mkOption {
default = false;
example = true;

View file

@ -65,12 +65,8 @@ let
# Network interfaces.
(import ../upstart-jobs/network-interfaces.nix {
inherit modprobe;
inherit modprobe config;
inherit (pkgs) nettools wirelesstools bash writeText;
nameservers = config.networking.nameservers;
defaultGateway = config.networking.defaultGateway;
interfaces = config.networking.interfaces;
localCommands = config.networking.localCommands;
})
# Nix daemon - required for multi-user Nix.

View file

@ -1,16 +1,15 @@
{ nettools, modprobe, wirelesstools, bash, writeText
, nameservers, defaultGateway, interfaces
, localCommands
}:
{nettools, modprobe, wirelesstools, bash, writeText, config}:
let
cfg = config.networking;
# !!! use XML
names = map (i: i.name) interfaces;
ipAddresses = map (i: if i ? ipAddress then i.ipAddress else "dhcp") interfaces;
subnetMasks = map (i: if i ? subnetMask then i.subnetMask else "default") interfaces;
essids = map (i: if i ? essid then i.essid else "default") interfaces;
wepKeys = map (i: if i ? wepKey then i.wepKey else "nokey") interfaces;
names = map (i: i.name) cfg.interfaces;
ipAddresses = map (i: if i ? ipAddress then i.ipAddress else "dhcp") cfg.interfaces;
subnetMasks = map (i: if i ? subnetMask then i.subnetMask else "default") cfg.interfaces;
essids = map (i: if i ? essid then i.essid else "default") cfg.interfaces;
wepKeys = map (i: if i ? wepKey then i.wepKey else "nokey") cfg.interfaces;
in
@ -66,20 +65,23 @@ start script
done
# Set the nameservers.
if test -n \"${toString nameservers}\"; then
if test -n \"${toString cfg.nameservers}\"; then
rm -f /etc/resolv.conf
for i in ${toString nameservers}; do
if test -n \"${cfg.domain}\"; then
echo \"domain ${cfg.domain}\" >> /etc/resolv.conf
fi
for i in ${toString cfg.nameservers}; do
echo \"nameserver $i\" >> /etc/resolv.conf
done
fi
# Set the default gateway.
if test -n \"${defaultGateway}\"; then
${nettools}/sbin/route add default gw \"${defaultGateway}\" || true
if test -n \"${cfg.defaultGateway}\"; then
${nettools}/sbin/route add default gw \"${cfg.defaultGateway}\" || true
fi
# Run any user-specified commands.
${bash}/bin/sh ${writeText "local-net-cmds" localCommands} || true
${bash}/bin/sh ${writeText "local-net-cmds" cfg.localCommands} || true
end script