From 6972c8d5ddfb99e3f38c235a18ce799926e6925c Mon Sep 17 00:00:00 2001 From: Rouven Seifert Date: Wed, 24 May 2023 15:51:58 +0200 Subject: [PATCH] simple mailserver config --- flake.lock | 99 ++++++++++++++- flake.nix | 8 ++ hosts/falkenstein-1/default.nix | 4 + hosts/falkenstein-1/modules/mail/default.nix | 8 ++ users/rouven/modules/accounts/default.nix | 120 +++++++++---------- 5 files changed, 173 insertions(+), 66 deletions(-) create mode 100644 hosts/falkenstein-1/modules/mail/default.nix diff --git a/flake.lock b/flake.lock index d63744b..da12a81 100644 --- a/flake.lock +++ b/flake.lock @@ -16,6 +16,38 @@ "type": "github" } }, + "blobs": { + "flake": false, + "locked": { + "lastModified": 1604995301, + "narHash": "sha256-wcLzgLec6SGJA8fx1OEN1yV/Py5b+U5iyYpksUY/yLw=", + "owner": "simple-nixos-mailserver", + "repo": "blobs", + "rev": "2cccdf1ca48316f2cfd1c9a0017e8de5a7156265", + "type": "gitlab" + }, + "original": { + "owner": "simple-nixos-mailserver", + "repo": "blobs", + "type": "gitlab" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1668681692, + "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "009399224d5e398d03b22badca40a37ac85412a1", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -43,11 +75,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1684844798, - "narHash": "sha256-ZrMXFoEA535jOZ+eDA3s+URZ5MkVRksBgL5qGnb6Ciw=", + "lastModified": 1684919509, + "narHash": "sha256-1HbQ4Y/DC59dFhUxBDV+tEzftlNvirHbIlg6axPusoo=", "owner": "hyprwm", "repo": "Hyprland", - "rev": "eb1f832fcec5838053c6b031b656e4f949ada57b", + "rev": "5bfd5a92404c9da08c187096d54c18274c737a00", "type": "github" }, "original": { @@ -133,11 +165,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1684169666, - "narHash": "sha256-N5jrykeSxLVgvm3Dd3hZ38/XwM/jU+dltqlXgrGlYxk=", + "lastModified": 1684899633, + "narHash": "sha256-NtwerXX8UFsoNy6k+DukJMriWtEjQtMU/Urbff2O2Dg=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "71ce85372a614d418d5e303dd5702a79d1545c04", + "rev": "4cc688ee711159b9bcb5a367be44007934e1a49d", "type": "github" }, "original": { @@ -161,6 +193,21 @@ "type": "github" } }, + "nixpkgs-22_11": { + "locked": { + "lastModified": 1669558522, + "narHash": "sha256-yqxn+wOiPqe6cxzOo4leeJOp1bXE/fjPEi/3F/bBHv8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ce5fe99df1f15a09a91a86be9738d68fadfbad82", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-22.11", + "type": "indirect" + } + }, "nixpkgs-lib": { "locked": { "lastModified": 1680397293, @@ -237,10 +284,35 @@ "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs_2", "purge": "purge", + "simple-nixos-mailserver": "simple-nixos-mailserver", "sops-nix": "sops-nix", "trucksimulatorbot-images": "trucksimulatorbot-images" } }, + "simple-nixos-mailserver": { + "inputs": { + "blobs": "blobs", + "flake-compat": "flake-compat", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-22_11": "nixpkgs-22_11", + "utils": "utils" + }, + "locked": { + "lastModified": 1684874496, + "narHash": "sha256-UinOcfH+PvkYsnpsty8uIUrag62Yre2jlBjP2h70dI8=", + "owner": "simple-nixos-mailserver", + "repo": "nixos-mailserver", + "rev": "d8131ffc61553df6137b382eec380689596cae3d", + "type": "gitlab" + }, + "original": { + "owner": "simple-nixos-mailserver", + "repo": "nixos-mailserver", + "type": "gitlab" + } + }, "sops-nix": { "inputs": { "nixpkgs": [ @@ -281,6 +353,21 @@ "type": "github" } }, + "utils": { + "locked": { + "lastModified": 1605370193, + "narHash": "sha256-YyMTf3URDL/otKdKgtoMChu4vfVL3vCMkRqpGifhUn0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5021eac20303a61fafe17224c087f5519baed54d", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "wlroots": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index f0f7e67..c11a591 100644 --- a/flake.nix +++ b/flake.nix @@ -31,6 +31,12 @@ url = "github:therealr5/trucksimulatorbot-images"; inputs.nixpkgs.follows = "nixpkgs"; }; + + simple-nixos-mailserver = { + url = "gitlab:simple-nixos-mailserver/nixos-mailserver"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; outputs = @@ -45,6 +51,7 @@ , nixos-hardware , purge , trucksimulatorbot-images + , simple-nixos-mailserver , ... }@attrs: { packages.x86_64-linux.iso = self.nixosConfigurations.iso.config.system.build.isoImage; @@ -98,6 +105,7 @@ sops-nix.nixosModules.sops purge.nixosModules.default trucksimulatorbot-images.nixosModules.default + simple-nixos-mailserver.nixosModules.default ]; }; vm = nixpkgs.lib.nixosSystem { diff --git a/hosts/falkenstein-1/default.nix b/hosts/falkenstein-1/default.nix index 86f4577..926ae62 100644 --- a/hosts/falkenstein-1/default.nix +++ b/hosts/falkenstein-1/default.nix @@ -38,6 +38,10 @@ htop-vim helix ]; + users.users.rouven = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + }; programs.git = { enable = true; config = { diff --git a/hosts/falkenstein-1/modules/mail/default.nix b/hosts/falkenstein-1/modules/mail/default.nix new file mode 100644 index 0000000..e0da054 --- /dev/null +++ b/hosts/falkenstein-1/modules/mail/default.nix @@ -0,0 +1,8 @@ +{ ... }: +{ + mailserver = { + enable = true; + fqdn = "mail.rfive.de"; + domains = [ "rfive.de" ]; + }; +} diff --git a/users/rouven/modules/accounts/default.nix b/users/rouven/modules/accounts/default.nix index dc976d4..226745f 100644 --- a/users/rouven/modules/accounts/default.nix +++ b/users/rouven/modules/accounts/default.nix @@ -38,66 +38,66 @@ in msmtp.enable = true; }; accounts.email.accounts = { - "rouven@rfive.de" = rec { - address = "rouven@rfive.de"; - gpg.key = gpg-default-key; - realName = "Rouven Seifert"; - userName = address; - passwordCommand = "${pkgs.coreutils}/bin/cat $XDG_RUNTIME_DIR/secrets/email/rfive"; - imap = { - host = "pro1.mail.ovh.net"; - port = 993; - }; - smtp = { - host = "pro1.mail.ovh.net"; - port = 587; - tls.useStartTls = true; - }; - msmtp.enable = true; - mbsync = { - enable = true; - create = "maildir"; - expunge = "both"; - groups.rfive = { - channels.inbox = { - nearPattern = "INBOX"; - farPattern = "INBOX"; - extraConfig.Create = "near"; - }; - channels.trash = { - nearPattern = "Trash"; - farPattern = "Gel&APY-schte Elemente"; - extraConfig.Create = "near"; - }; - channels.sent = { - nearPattern = "Sent"; - farPattern = "Gesendete Elemente"; - extraConfig.Create = "near"; - }; - channels.junk = { - nearPattern = "Junk"; - farPattern = "Junk-E-Mail"; - extraConfig.Create = "near"; - }; - channels.drafts = { - nearPattern = "Drafts"; - farPattern = "Entw&APw-rfe"; - extraConfig.Create = "near"; - }; - }; - extraConfig = { - account = { - AuthMechs = "Login"; - }; - }; - }; - neomutt = let c = mbsync.groups.rfive.channels; in - { - enable = true; - mailboxName = " 󰒋 rfive.de"; - extraMailboxes = lib.lists.forEach [ c.sent c.trash c.junk c.drafts ] (x: x.nearPattern); - }; - }; + # "rouven@rfive.de" = rec { + # address = "rouven@rfive.de"; + # gpg.key = gpg-default-key; + # realName = "Rouven Seifert"; + # userName = address; + # passwordCommand = "${pkgs.coreutils}/bin/cat $XDG_RUNTIME_DIR/secrets/email/rfive"; + # imap = { + # host = "pro1.mail.ovh.net"; + # port = 993; + # }; + # smtp = { + # host = "pro1.mail.ovh.net"; + # port = 587; + # tls.useStartTls = true; + # }; + # msmtp.enable = true; + # mbsync = { + # enable = true; + # create = "maildir"; + # expunge = "both"; + # groups.rfive = { + # channels.inbox = { + # nearPattern = "INBOX"; + # farPattern = "INBOX"; + # extraConfig.Create = "near"; + # }; + # channels.trash = { + # nearPattern = "Trash"; + # farPattern = "Gel&APY-schte Elemente"; + # extraConfig.Create = "near"; + # }; + # channels.sent = { + # nearPattern = "Sent"; + # farPattern = "Gesendete Elemente"; + # extraConfig.Create = "near"; + # }; + # channels.junk = { + # nearPattern = "Junk"; + # farPattern = "Junk-E-Mail"; + # extraConfig.Create = "near"; + # }; + # channels.drafts = { + # nearPattern = "Drafts"; + # farPattern = "Entw&APw-rfe"; + # extraConfig.Create = "near"; + # }; + # }; + # extraConfig = { + # account = { + # AuthMechs = "Login"; + # }; + # }; + # }; + # neomutt = let c = mbsync.groups.rfive.channels; in + # { + # enable = true; + # mailboxName = " 󰒋 rfive.de"; + # extraMailboxes = lib.lists.forEach [ c.sent c.trash c.junk c.drafts ] (x: x.nearPattern); + # }; + # }; "TU-Dresden" = rec { address = "rouven.seifert@mailbox.tu-dresden.de"; gpg.key = gpg-default-key;