forked from mirrors_public/oddlama_nix-config
feat: fix DNS entry listing in stalwart via patch, increase concurrent imap limit, allow aliasing existing mailboxes
This commit is contained in:
parent
938b409468
commit
d58364619f
5 changed files with 274 additions and 61 deletions
|
@ -4,6 +4,7 @@ _inputs: [
|
|||
(_final: prev: {
|
||||
deploy = prev.callPackage ./deploy.nix {};
|
||||
git-fuzzy = prev.callPackage ./git-fuzzy {};
|
||||
stalwart-mail = prev.callPackage ./stal.nix {};
|
||||
kanidm = prev.kanidm.overrideAttrs (old: let
|
||||
provisionSrc = prev.fetchFromGitHub {
|
||||
owner = "oddlama";
|
||||
|
|
149
pkgs/stal.nix
Normal file
149
pkgs/stal.nix
Normal file
|
@ -0,0 +1,149 @@
|
|||
{
|
||||
lib,
|
||||
rustPlatform,
|
||||
fetchFromGitHub,
|
||||
fetchpatch,
|
||||
pkg-config,
|
||||
protobuf,
|
||||
bzip2,
|
||||
openssl,
|
||||
sqlite,
|
||||
foundationdb,
|
||||
zstd,
|
||||
stdenv,
|
||||
darwin,
|
||||
nix-update-script,
|
||||
nixosTests,
|
||||
rocksdb_8_11,
|
||||
}: let
|
||||
# Stalwart depends on rocksdb crate:
|
||||
# https://github.com/stalwartlabs/mail-server/blob/v0.8.0/crates/store/Cargo.toml#L10
|
||||
# which expects a specific rocksdb versions:
|
||||
# https://github.com/rust-rocksdb/rust-rocksdb/blob/v0.22.0/librocksdb-sys/Cargo.toml#L3
|
||||
# See upstream issue for rocksdb 9.X support
|
||||
# https://github.com/stalwartlabs/mail-server/issues/407
|
||||
rocksdb = rocksdb_8_11;
|
||||
version = "0.9.0";
|
||||
in
|
||||
rustPlatform.buildRustPackage {
|
||||
pname = "stalwart-mail";
|
||||
inherit version;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "stalwartlabs";
|
||||
repo = "mail-server";
|
||||
# XXX: We need to use a revisoin two commits after v0.9.0, which includes fixes for test cases.
|
||||
# Can be reverted to "v${version}" next release.
|
||||
rev = "2a12e251f2591b7785d7a921364f125d2e9c1e6e";
|
||||
hash = "sha256-qoU09tLpOlsy5lKv2GdCV23bd70hnNZ0r/O5APGVDyw=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
cargoHash = "sha256-rGCu3J+hTxiIENDIQM/jPz1wUNJr0ouoa1IkwWKfOWM=";
|
||||
|
||||
patches = [
|
||||
# Remove "PermissionsStartOnly" from systemd service files,
|
||||
# which is deprecated and conflicts with our module's ExecPreStart.
|
||||
# Upstream PR: https://github.com/stalwartlabs/mail-server/pull/528
|
||||
(fetchpatch {
|
||||
url = "https://github.com/stalwartlabs/mail-server/pull/528/commits/6e292b3d7994441e58e367b87967c9a277bce490.patch";
|
||||
hash = "sha256-j/Li4bYNE7IppxG3FGfljra70/rHyhRvDgOkZOlhMHY=";
|
||||
})
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
protobuf
|
||||
rustPlatform.bindgenHook
|
||||
];
|
||||
|
||||
buildInputs =
|
||||
[
|
||||
bzip2
|
||||
openssl
|
||||
sqlite
|
||||
foundationdb
|
||||
zstd
|
||||
]
|
||||
++ lib.optionals stdenv.isDarwin [
|
||||
darwin.apple_sdk.frameworks.CoreFoundation
|
||||
darwin.apple_sdk.frameworks.Security
|
||||
darwin.apple_sdk.frameworks.SystemConfiguration
|
||||
];
|
||||
|
||||
env = {
|
||||
OPENSSL_NO_VENDOR = true;
|
||||
ZSTD_SYS_USE_PKG_CONFIG = true;
|
||||
ROCKSDB_INCLUDE_DIR = "${rocksdb}/include";
|
||||
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
|
||||
};
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p $out/etc/stalwart
|
||||
cp resources/config/spamfilter.toml $out/etc/stalwart/spamfilter.toml
|
||||
cp -r resources/config/spamfilter $out/etc/stalwart/
|
||||
|
||||
mkdir -p $out/lib/systemd/system
|
||||
|
||||
substitute resources/systemd/stalwart-mail.service $out/lib/systemd/system/stalwart-mail.service \
|
||||
--replace "__PATH__" "$out"
|
||||
'';
|
||||
|
||||
checkFlags = [
|
||||
# Require running mysql, postgresql daemon
|
||||
"--skip=directory::imap::imap_directory"
|
||||
"--skip=directory::internal::internal_directory"
|
||||
"--skip=directory::ldap::ldap_directory"
|
||||
"--skip=directory::sql::sql_directory"
|
||||
"--skip=store::blob::blob_tests"
|
||||
"--skip=store::lookup::lookup_tests"
|
||||
# thread 'directory::smtp::lmtp_directory' panicked at tests/src/store/mod.rs:122:44:
|
||||
# called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }
|
||||
"--skip=directory::smtp::lmtp_directory"
|
||||
# thread 'imap::imap_tests' panicked at tests/src/imap/mod.rs:436:14:
|
||||
# Missing store type. Try running `STORE=<store_type> cargo test`: NotPresent
|
||||
"--skip=imap::imap_tests"
|
||||
# thread 'jmap::jmap_tests' panicked at tests/src/jmap/mod.rs:303:14:
|
||||
# Missing store type. Try running `STORE=<store_type> cargo test`: NotPresent
|
||||
"--skip=jmap::jmap_tests"
|
||||
# Failed to read system DNS config: io error: No such file or directory (os error 2)
|
||||
"--skip=smtp::inbound::data::data"
|
||||
# Expected "X-My-Header: true" but got Received: from foobar.net (unknown [10.0.0.123])
|
||||
"--skip=smtp::inbound::scripts::sieve_scripts"
|
||||
# panicked at tests/src/smtp/outbound/smtp.rs:173:5:
|
||||
"--skip=smtp::outbound::smtp::smtp_delivery"
|
||||
# thread 'smtp::queue::retry::queue_retry' panicked at tests/src/smtp/queue/retry.rs:119:5:
|
||||
# assertion `left == right` failed
|
||||
# left: [1, 2, 2]
|
||||
# right: [1, 2, 3]
|
||||
"--skip=smtp::queue::retry::queue_retry"
|
||||
# Missing store type. Try running `STORE=<store_type> cargo test`: NotPresent
|
||||
"--skip=store::store_tests"
|
||||
# thread 'config::parser::tests::toml_parse' panicked at crates/utils/src/config/parser.rs:463:58:
|
||||
# called `Result::unwrap()` on an `Err` value: "Expected ['\\n'] but found '!' in value at line 70."
|
||||
"--skip=config::parser::tests::toml_parse"
|
||||
# error[E0432]: unresolved import `r2d2_sqlite`
|
||||
# use of undeclared crate or module `r2d2_sqlite`
|
||||
"--skip=backend::sqlite::pool::SqliteConnectionManager::with_init"
|
||||
# thread 'smtp::reporting::analyze::report_analyze' panicked at tests/src/smtp/reporting/analyze.rs:88:5:
|
||||
# assertion `left == right` failed
|
||||
# left: 0
|
||||
# right: 12
|
||||
"--skip=smtp::reporting::analyze::report_analyze"
|
||||
];
|
||||
|
||||
doCheck = !(stdenv.isLinux && stdenv.isAarch64);
|
||||
|
||||
passthru = {
|
||||
update-script = nix-update-script {};
|
||||
tests.stalwart-mail = nixosTests.stalwart-mail;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Secure & Modern All-in-One Mail Server (IMAP, JMAP, SMTP)";
|
||||
homepage = "https://github.com/stalwartlabs/mail-server";
|
||||
changelog = "https://github.com/stalwartlabs/mail-server/blob/${version}/CHANGELOG";
|
||||
license = licenses.agpl3Only;
|
||||
maintainers = with maintainers; [happysalada onny oddlama];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue