* Options for configuring the (mail) domain.
svn path=/nixos/trunk/; revision=9785
This commit is contained in:
parent
e7e685e4ce
commit
9dd7891820
@ -134,10 +134,11 @@ import ../helpers/make-etc.nix {
|
|||||||
|
|
||||||
# Configuration for ssmtp.
|
# Configuration for ssmtp.
|
||||||
++ optional config.networking.defaultMailServer.directDelivery {
|
++ optional config.networking.defaultMailServer.directDelivery {
|
||||||
source = pkgs.writeText "ssmtp.conf" "
|
source = let cfg = config.networking.defaultMailServer; in pkgs.writeText "ssmtp.conf" "
|
||||||
mailhub=${config.networking.defaultMailServer.hostName}
|
mailhub=${cfg.hostName}
|
||||||
UseTLS=${if config.networking.defaultMailServer.useTLS then "YES" else "NO"}
|
${if cfg.domain != "" then "rewriteDomain=${cfg.domain}" else ""}
|
||||||
UseSTARTTLS=${if config.networking.defaultMailServer.useSTARTTLS then "YES" else "NO"}
|
UseTLS=${if cfg.useTLS then "YES" else "NO"}
|
||||||
|
UseSTARTTLS=${if cfg.useSTARTTLS then "YES" else "NO"}
|
||||||
#Debug=YES
|
#Debug=YES
|
||||||
";
|
";
|
||||||
target = "ssmtp/ssmtp.conf";
|
target = "ssmtp/ssmtp.conf";
|
||||||
|
@ -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 {
|
enableIntel2200BGFirmware = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
description = "
|
description = "
|
||||||
@ -335,6 +343,14 @@
|
|||||||
";
|
";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
domain = mkOption {
|
||||||
|
default = "";
|
||||||
|
example = "example.org";
|
||||||
|
description = "
|
||||||
|
The domain from which mail will appear to be sent.
|
||||||
|
";
|
||||||
|
};
|
||||||
|
|
||||||
useTLS = mkOption {
|
useTLS = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
example = true;
|
example = true;
|
||||||
|
@ -65,12 +65,8 @@ let
|
|||||||
|
|
||||||
# Network interfaces.
|
# Network interfaces.
|
||||||
(import ../upstart-jobs/network-interfaces.nix {
|
(import ../upstart-jobs/network-interfaces.nix {
|
||||||
inherit modprobe;
|
inherit modprobe config;
|
||||||
inherit (pkgs) nettools wirelesstools bash writeText;
|
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.
|
# Nix daemon - required for multi-user Nix.
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
{ nettools, modprobe, wirelesstools, bash, writeText
|
{nettools, modprobe, wirelesstools, bash, writeText, config}:
|
||||||
, nameservers, defaultGateway, interfaces
|
|
||||||
, localCommands
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
|
cfg = config.networking;
|
||||||
|
|
||||||
# !!! use XML
|
# !!! use XML
|
||||||
names = map (i: i.name) interfaces;
|
names = map (i: i.name) cfg.interfaces;
|
||||||
ipAddresses = map (i: if i ? ipAddress then i.ipAddress else "dhcp") 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") 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") 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") interfaces;
|
wepKeys = map (i: if i ? wepKey then i.wepKey else "nokey") cfg.interfaces;
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
@ -66,20 +65,23 @@ start script
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Set the nameservers.
|
# Set the nameservers.
|
||||||
if test -n \"${toString nameservers}\"; then
|
if test -n \"${toString cfg.nameservers}\"; then
|
||||||
rm -f /etc/resolv.conf
|
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
|
echo \"nameserver $i\" >> /etc/resolv.conf
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set the default gateway.
|
# Set the default gateway.
|
||||||
if test -n \"${defaultGateway}\"; then
|
if test -n \"${cfg.defaultGateway}\"; then
|
||||||
${nettools}/sbin/route add default gw \"${defaultGateway}\" || true
|
${nettools}/sbin/route add default gw \"${cfg.defaultGateway}\" || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run any user-specified commands.
|
# 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
|
end script
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user