diff --git a/default.nix b/default.nix index 1d44211..242888e 100644 --- a/default.nix +++ b/default.nix @@ -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; }; - }; } diff --git a/mail-server/networking.nix b/mail-server/networking.nix index 750f2e8..e355252 100644 --- a/mail-server/networking.nix +++ b/mail-server/networking.nix @@ -14,15 +14,21 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see -{ domain, hostPrefix, enableImap, enablePop3 }: +{ config, pkgs, lib, ... }: +let + cfg = config.mailserver; +in { - #hostName = "${hostPrefix}.${domain}"; + config = with cfg; lib.mkIf enable { - firewall = { - enable = true; - allowedTCPPorts = [ 25 587 ] - ++ (if enableImap then [ 143 ] else []) - ++ (if enablePop3 then [ 110 ] else []); + networking.hostName = "${hostPrefix}.${domain}"; + + networking.firewall = { + enable = true; + allowedTCPPorts = [ 25 587 ] + ++ (if enableImap then [ 143 ] else []) + ++ (if enablePop3 then [ 110 ] else []); + }; }; }