2023-07-23 16:13:47 +00:00
|
|
|
{ lib
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pkg-config
|
|
|
|
, protobuf
|
|
|
|
, bzip2
|
|
|
|
, openssl
|
|
|
|
, sqlite
|
|
|
|
, zstd
|
|
|
|
, stdenv
|
|
|
|
, darwin
|
2023-07-28 08:32:22 +00:00
|
|
|
, nix-update-script
|
2024-05-14 23:15:12 +00:00
|
|
|
, nixosTests
|
2024-04-17 15:19:10 +00:00
|
|
|
, rocksdb_8_11
|
2023-07-23 16:13:47 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2024-04-17 15:19:10 +00:00
|
|
|
# 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;
|
2024-05-23 16:54:49 +00:00
|
|
|
version = "0.8.1";
|
2023-07-23 16:13:47 +00:00
|
|
|
in
|
|
|
|
rustPlatform.buildRustPackage {
|
|
|
|
pname = "stalwart-mail";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "stalwartlabs";
|
|
|
|
repo = "mail-server";
|
|
|
|
rev = "v${version}";
|
2024-05-23 16:54:49 +00:00
|
|
|
hash = "sha256-al2+/+HPbjJ30rju2ih/yFZgmTdO2bQ6jDv+dtoIqsc=";
|
2023-07-23 16:13:47 +00:00
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
|
|
|
|
2024-05-23 16:54:49 +00:00
|
|
|
cargoHash = "sha256-ek9vPo/M4peDcDkfzjXoKlJ+gFZUiREwNflOKEJNaWQ=";
|
2023-07-23 16:13:47 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
protobuf
|
2024-01-13 19:22:43 +00:00
|
|
|
rustPlatform.bindgenHook
|
2023-07-23 16:13:47 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
bzip2
|
|
|
|
openssl
|
|
|
|
sqlite
|
|
|
|
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;
|
2024-01-13 19:22:43 +00:00
|
|
|
ROCKSDB_INCLUDE_DIR = "${rocksdb}/include";
|
|
|
|
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
|
2023-07-23 16:13:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# Tests require reading to /etc/resolv.conf
|
|
|
|
doCheck = false;
|
|
|
|
|
2024-05-14 23:15:12 +00:00
|
|
|
passthru = {
|
|
|
|
update-script = nix-update-script { };
|
2024-05-15 15:03:14 +00:00
|
|
|
tests.stalwart-mail = nixosTests.stalwart-mail;
|
2024-05-14 23:15:12 +00:00
|
|
|
};
|
2023-07-28 08:32:22 +00:00
|
|
|
|
2023-07-23 16:13:47 +00:00
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|