networking to module

This commit is contained in:
Robin Raymond 2017-09-02 14:58:33 +02:00
parent 201c532a67
commit 9ac491f87d
2 changed files with 14 additions and 12 deletions

View file

@ -251,6 +251,7 @@ in
./mail-server/clamav.nix
./mail-server/users.nix
./mail-server/environment.nix
./mail-server/networking.nix
];
config = mkIf cfg.enable {
@ -261,16 +262,11 @@ in
certificateScheme certificateFile keyFile certificateDirectory virusScanning;
};
networking = import ./mail-server/networking.nix {
inherit (cfg) domain hostPrefix enableImap enablePop3;
};
systemd = import ./mail-server/systemd.nix {
inherit pkgs;
inherit (cfg) mailDirectory vmailGroupName certificateScheme
certificateDirectory
hostPrefix domain dkimSelector dkimKeyDirectory;
};
};
}

View file

@ -14,15 +14,21 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
{ domain, hostPrefix, enableImap, enablePop3 }:
{ config, pkgs, lib, ... }:
let
cfg = config.mailserver;
in
{
#hostName = "${hostPrefix}.${domain}";
config = with cfg; lib.mkIf enable {
firewall = {
networking.hostName = "${hostPrefix}.${domain}";
networking.firewall = {
enable = true;
allowedTCPPorts = [ 25 587 ]
++ (if enableImap then [ 143 ] else [])
++ (if enablePop3 then [ 110 ] else []);
};
};
}