summaryrefslogtreecommitdiff
path: root/profiles/server
diff options
context:
space:
mode:
authorMike Vink <mike1994vink@gmail.com>2023-10-19 22:35:14 +0200
committerMike Vink <mike1994vink@gmail.com>2023-10-19 22:35:14 +0200
commitc17f8dd9bf5030e66a5d3d4b927a27854b933122 (patch)
treeb00e3c1844824f3633fe2812727002e6201a1f60 /profiles/server
parent40b0c12e3e7a106c90fa454f03b25efddcef2e67 (diff)
start mailserver
Diffstat (limited to 'profiles/server')
-rw-r--r--profiles/server/acme.nix11
-rw-r--r--profiles/server/mail.nix24
-rw-r--r--profiles/server/nginx.nix16
3 files changed, 51 insertions, 0 deletions
diff --git a/profiles/server/acme.nix b/profiles/server/acme.nix
new file mode 100644
index 0000000..c0d7306
--- /dev/null
+++ b/profiles/server/acme.nix
@@ -0,0 +1,11 @@
+{ config, ... }: {
+ security.acme = {
+ acceptTerms = true;
+ defaults = {
+ extraLegoRunFlags = ["--preferred-chain" "ISRG Root X1"];
+ email = ivi.email;
+ dnsProvider = "porkbun";
+ credentialsFile = config.secrets.porkbun.path;
+ };
+ };
+}
diff --git a/profiles/server/mail.nix b/profiles/server/mail.nix
new file mode 100644
index 0000000..c6837ef
--- /dev/null
+++ b/profiles/server/mail.nix
@@ -0,0 +1,24 @@
+{ inputs, config, lib, ... }: with lib; {
+ imports = [
+ inputs.simple-nixos-mailserver.nixosModule
+ ];
+ mailserver = {
+ enable = true;
+ enableImap = false;
+ enableSubmission = true;
+ enableImapSsl = true;
+ enableSubmissionSsl = true;
+
+ fqdn = ivi.domain;
+ domains = [ ivi.domain ];
+ loginAccounts = {
+ ${ivi.email} = {
+ hashedPasswordFile = config.secrets.ivi.path;
+ aliases = [ "@${ivi.domain}" ];
+ };
+ };
+ certificateScheme = "acme";
+
+ lmtpSaveToDetailMailbox = "no";
+ };
+}
diff --git a/profiles/server/nginx.nix b/profiles/server/nginx.nix
new file mode 100644
index 0000000..526a8e7
--- /dev/null
+++ b/profiles/server/nginx.nix
@@ -0,0 +1,16 @@
+{ inputs, lib, ... }: with lib; {
+ # apparently you can set defaults on existing modules?
+ options.services.nginx.virtualHosts = mkOption {
+ type = types.attrsOf (types.submodule ({ name, ... }: {
+ config = mkIf (name != "default") {
+ forceSSL = mkDefault true;
+ enableACME = mkDefault true;
+ };
+ }));
+ };
+ config = {
+ services.nginx = {
+ enable = true;
+ };
+ };
+}