From 201c532a67f285120a350407b0f483851979b034 Mon Sep 17 00:00:00 2001 From: Robin Raymond Date: Sat, 2 Sep 2017 14:04:07 +0200 Subject: [PATCH] environment to module --- default.nix | 6 +----- mail-server/environment.nix | 13 +++++++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/default.nix b/default.nix index d570c52..1d44211 100644 --- a/default.nix +++ b/default.nix @@ -250,6 +250,7 @@ in imports = [ ./mail-server/clamav.nix ./mail-server/users.nix + ./mail-server/environment.nix ]; config = mkIf cfg.enable { @@ -260,11 +261,6 @@ in certificateScheme certificateFile keyFile certificateDirectory virusScanning; }; - environment = import ./mail-server/environment.nix { - inherit pkgs; - inherit (cfg) certificateScheme; - }; - networking = import ./mail-server/networking.nix { inherit (cfg) domain hostPrefix enableImap enablePop3; }; diff --git a/mail-server/environment.nix b/mail-server/environment.nix index 4ffdd2a..48e68c7 100644 --- a/mail-server/environment.nix +++ b/mail-server/environment.nix @@ -14,10 +14,15 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see -{ pkgs, certificateScheme }: +{ config, pkgs, lib, ... }: +let + cfg = config.mailserver; +in { - systemPackages = with pkgs; [ - dovecot opendkim openssh postfix clamav rspamd rmilter - ] ++ (if certificateScheme == 2 then [ openssl ] else []); + config = with cfg; lib.mkIf enable { + environment.systemPackages = with pkgs; [ + dovecot opendkim openssh postfix clamav rspamd rmilter + ] ++ (if certificateScheme == 2 then [ openssl ] else []); + }; }