From a717779e6aaf5f48e7036dbee6229f32008e8b89 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Fri, 28 Jun 2024 21:47:50 +0200 Subject: [PATCH] migrate to stalwart-mail --- .gitmodules | 3 ++ flake.lock | 6 ++-- vm-nextcloud.nix | 84 ++++++++++++++++++++++++++++++++++-------------- 3 files changed, 66 insertions(+), 27 deletions(-) diff --git a/.gitmodules b/.gitmodules index 26dd48f..73836e4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -23,3 +23,6 @@ [submodule "calendar-js"] path = calendar-js url = https://github.com/nextcloud/calendar-js.git +[submodule "files_mindmap"] + path = files_mindmap + url = https://github.com/onny/files_mindmap.git diff --git a/flake.lock b/flake.lock index dc19b26..c4b4a0c 100644 --- a/flake.lock +++ b/flake.lock @@ -35,11 +35,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1719253556, - "narHash": "sha256-A/76RFUVxZ/7Y8+OMVL1Lc8LRhBxZ8ZE2bpMnvZ1VpY=", + "lastModified": 1719426051, + "narHash": "sha256-yJL9VYQhaRM7xs0M867ZFxwaONB9T2Q4LnGo1WovuR4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "fc07dc3bdf2956ddd64f24612ea7fc894933eb2e", + "rev": "89c49874fb15f4124bf71ca5f42a04f2ee5825fd", "type": "github" }, "original": { diff --git a/vm-nextcloud.nix b/vm-nextcloud.nix index c7a8429..18d8304 100644 --- a/vm-nextcloud.nix +++ b/vm-nextcloud.nix @@ -15,6 +15,12 @@ # Remove first run wizard and password policy check from Nextcloud # package nextcloud29 = super.nextcloud29.overrideAttrs (oldAttrs: rec { + version = "29.0.3"; + # FIXME + src = builtins.fetchurl { + url = "https://download.nextcloud.com/server/releases/nextcloud-${version}.tar.bz2"; + sha256 = "1m3zvcf77mrb7bhhn4hb53ry5f1nqwl5p3sdhkw2f28j9iv6x6d5"; + }; installPhase = oldAttrs.installPhase + '' mkdir -p $out/ cp -R . $out/ @@ -105,6 +111,10 @@ target = /home/onny/projects/nixos-nextcloud-testumgebung/cleanup; cache = "none"; }; + "/var/lib/nextcloud/store-apps/files_mindmap" = { + target = /home/onny/projects/nixos-nextcloud-testumgebung/files_mindmap; + cache = "none"; + }; #"/var/lib/nextcloud/server" = { # target = /home/onny/projects/nixos-nextcloud-testumgebung/server; # cache = "none"; @@ -114,30 +124,56 @@ #services.nginx.virtualHosts."localhost".root = lib.mkForce "/var/lib/nextcloud/server"; # Setup mail server - # FIXME maybe switchto stalwart - services.maddy = { + services.stalwart-mail = { enable = true; - hostname = "localhost"; - primaryDomain = "localhost"; - localDomains = [ - "$(primary_domain)" - "10.0.2.0/24" - "10.100.100.1" - "127.0.0.1" - ]; - # Disable any sender vhttps://github.com/obsidiansystems/ipfs-nix-guide/alidation checks - config = lib.concatStrings ( - builtins.match "(.*)authorize_sender.*identity\n[ ]+\}(.*)" options.services.maddy.config.default - ); - ensureAccounts = [ - "user1@localhost" - "user2@localhost" - "admin@localhost" - ]; - ensureCredentials = { - "user1@localhost".passwordFile = "${pkgs.writeText "password" "test123"}"; - "user2@localhost".passwordFile = "${pkgs.writeText "password" "test123"}"; - "admin@localhost".passwordFile = "${pkgs.writeText "password" "test123"}"; + # FIXME remove package definition in 24.11 + package = pkgs.stalwart-mail; + settings = { + server = { + hostname = "localhost"; + tls.enable = false; + listener = { + "smtp-submission" = { + bind = [ "[::]:587" ]; + protocol = "smtp"; + }; + "imap" = { + bind = [ "[::]:143" ]; + protocol = "imap"; + }; + }; + }; + imap.auth.allow-plain-text = true; + session.auth = { + mechanisms = "[plain, login]"; + directory = "'in-memory'"; + }; + storage.directory = "in-memory"; + session.rcpt.directory = "'in-memory'"; + queue.outbound.next-hop = "'local'"; + directory."in-memory" = { + type = "memory"; + principals = [ + { + class = "individual"; + name = "user1"; + secret = "test123"; + email = [ "user1@localhost" ]; + } + { + class = "individual"; + name = "user2"; + secret = "test123"; + email = [ "user2@localhost" ]; + } + { + class = "individual"; + name = "admin"; + secret = "test123"; + email = [ "admin@localhost" ]; + } + ]; + }; }; }; @@ -150,7 +186,7 @@ auth = "login"; tls = "off"; from = "admin@localhost"; - user = "admin@localhost"; + user = "admin"; password = "test123"; }; };