diff --git a/mail-server/systemd.nix b/mail-server/systemd.nix index a59e8ce..e009f44 100644 --- a/mail-server/systemd.nix +++ b/mail-server/systemd.nix @@ -41,9 +41,13 @@ let createDhParameterFile = '' # Create a dh parameter file - ${pkgs.openssl}/bin/openssl \ - dhparam ${builtins.toString cfg.dhParamBitLength} \ - > "${cfg.certificateDirectory}/dh.pem" + if [ ! -f "''${cfg.certificateDirectory}/dh.pem" ] + then + mkdir -p "${cfg.certificateDirectory}" + ${pkgs.openssl}/bin/openssl \ + dhparam ${builtins.toString cfg.dhParamBitLength} \ + > "${cfg.certificateDirectory}/dh.pem" + fi ''; createDomainDkimCert = dom: