2023-08-22 20:05:09 +00:00
|
|
|
{ lib
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitLab
|
|
|
|
, pkg-config
|
|
|
|
, sqlite
|
|
|
|
, stdenv
|
|
|
|
, darwin
|
|
|
|
, nixosTests
|
2024-06-05 15:53:02 +00:00
|
|
|
, rocksdb
|
2023-11-16 04:20:00 +00:00
|
|
|
, rust-jemalloc-sys
|
2023-08-22 20:05:09 +00:00
|
|
|
}:
|
2022-01-03 16:56:52 +00:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "matrix-conduit";
|
2024-06-20 14:57:18 +00:00
|
|
|
version = "0.8.0";
|
2022-01-03 16:56:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitLab {
|
|
|
|
owner = "famedly";
|
|
|
|
repo = "conduit";
|
|
|
|
rev = "v${version}";
|
2024-06-20 14:57:18 +00:00
|
|
|
hash = "sha256-/qKPeE2Ptweaf+rHOvdW0TUDLwN9D93MMgDoU4fTzEA=";
|
2022-01-03 16:56:52 +00:00
|
|
|
};
|
|
|
|
|
2023-03-24 00:07:29 +00:00
|
|
|
# We have to use importCargoLock here because `cargo vendor` currently doesn't support workspace
|
|
|
|
# inheritance within Git dependencies, but importCargoLock does.
|
|
|
|
cargoLock = {
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
outputHashes = {
|
2024-06-20 14:57:18 +00:00
|
|
|
"ruma-0.10.1" = "sha256-I1mTeJLo+pgIqFkn1D2De/oACQPkUELjGdyGf3MVuLQ=";
|
2023-03-24 00:07:29 +00:00
|
|
|
};
|
|
|
|
};
|
2023-02-02 18:25:31 +00:00
|
|
|
|
2023-03-24 00:07:29 +00:00
|
|
|
# Conduit enables rusqlite's bundled feature by default, but we'd rather use our copy of SQLite.
|
|
|
|
preBuild = ''
|
|
|
|
substituteInPlace Cargo.toml --replace "features = [\"bundled\"]" "features = []"
|
|
|
|
cargo update --offline -p rusqlite
|
|
|
|
'';
|
2022-02-10 20:34:41 +00:00
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
nativeBuildInputs = [
|
2022-03-05 16:20:37 +00:00
|
|
|
rustPlatform.bindgenHook
|
2023-03-24 00:07:29 +00:00
|
|
|
pkg-config
|
2022-02-10 20:34:41 +00:00
|
|
|
];
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
buildInputs = [
|
|
|
|
sqlite
|
|
|
|
rust-jemalloc-sys
|
2024-09-26 11:04:55 +00:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
2022-12-28 21:21:41 +00:00
|
|
|
darwin.apple_sdk.frameworks.Security
|
2024-06-20 14:57:18 +00:00
|
|
|
darwin.apple_sdk.frameworks.SystemConfiguration
|
2022-02-10 20:34:41 +00:00
|
|
|
];
|
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
env = {
|
|
|
|
ROCKSDB_INCLUDE_DIR = "${rocksdb}/include";
|
|
|
|
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
|
|
|
|
};
|
2023-02-02 18:25:31 +00:00
|
|
|
|
2022-12-28 21:21:41 +00:00
|
|
|
# tests failed on x86_64-darwin with SIGILL: illegal instruction
|
2024-09-26 11:04:55 +00:00
|
|
|
doCheck = !(stdenv.hostPlatform.isx86_64 && stdenv.hostPlatform.isDarwin);
|
2022-12-28 21:21:41 +00:00
|
|
|
|
|
|
|
passthru.tests = {
|
|
|
|
inherit (nixosTests) matrix-conduit;
|
|
|
|
};
|
2022-01-03 16:56:52 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Matrix homeserver written in Rust";
|
2022-01-03 16:56:52 +00:00
|
|
|
homepage = "https://conduit.rs/";
|
|
|
|
license = licenses.asl20;
|
2024-05-15 15:35:15 +00:00
|
|
|
maintainers = with maintainers; [ pstn pimeys ];
|
2022-12-28 21:21:41 +00:00
|
|
|
mainProgram = "conduit";
|
2022-01-03 16:56:52 +00:00
|
|
|
};
|
|
|
|
}
|