2023-08-11 08:10:18 +02:00
|
|
|
{ lib
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitLab
|
|
|
|
, pkg-config
|
|
|
|
, sqlite
|
|
|
|
, stdenv
|
|
|
|
, darwin
|
|
|
|
, nixosTests
|
2023-08-10 21:33:23 +02:00
|
|
|
, rocksdb
|
2023-07-13 21:13:10 +02:00
|
|
|
, rust-jemalloc-sys
|
2023-08-11 08:10:18 +02:00
|
|
|
}:
|
2021-09-02 11:23:48 +02:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "matrix-conduit";
|
2023-08-10 21:33:23 +02:00
|
|
|
version = "0.6.0";
|
2021-09-02 11:23:48 +02:00
|
|
|
|
|
|
|
src = fetchFromGitLab {
|
|
|
|
owner = "famedly";
|
|
|
|
repo = "conduit";
|
|
|
|
rev = "v${version}";
|
2023-08-10 21:33:23 +02:00
|
|
|
hash = "sha256-TpNssMHvSKcxJMas5lQNWEbIv09u4/niBN2C27Mp0JY=";
|
2021-09-02 11:23:48 +02:00
|
|
|
};
|
|
|
|
|
2023-02-19 22:37:28 +01: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 = {
|
|
|
|
"heed-0.10.6" = "sha256-rm02pJ6wGYN4SsAbp85jBVHDQ5ITjZZd+79EC2ubRsY=";
|
|
|
|
"reqwest-0.11.9" = "sha256-wH/q7REnkz30ENBIK5Rlxnc1F6vOyuEANMHFmiVPaGw=";
|
2023-08-10 21:33:23 +02:00
|
|
|
"ruma-0.8.2" = "sha256-GkHLY5unh7uyFNe0RS+3xQ4Ou8qBhzd+kEnCC7xUnMo=";
|
2023-02-19 22:37:28 +01:00
|
|
|
};
|
|
|
|
};
|
2023-01-20 01:40:29 +01:00
|
|
|
|
2023-02-19 22:37:28 +01: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-04 21:04:21 +01:00
|
|
|
|
2022-10-09 15:14:54 +02:00
|
|
|
nativeBuildInputs = [
|
2022-02-13 13:00:00 +01:00
|
|
|
rustPlatform.bindgenHook
|
2023-02-19 22:37:28 +01:00
|
|
|
pkg-config
|
2022-02-04 21:04:21 +01:00
|
|
|
];
|
|
|
|
|
2023-07-13 21:13:10 +02:00
|
|
|
buildInputs = [
|
|
|
|
sqlite
|
|
|
|
rust-jemalloc-sys
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
2022-12-17 19:26:17 +01:00
|
|
|
darwin.apple_sdk.frameworks.Security
|
2022-02-04 21:04:21 +01:00
|
|
|
];
|
|
|
|
|
2023-08-11 08:10:18 +02:00
|
|
|
env = {
|
2023-08-10 21:33:23 +02:00
|
|
|
ROCKSDB_INCLUDE_DIR = "${rocksdb}/include";
|
|
|
|
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
|
2023-08-11 08:10:18 +02:00
|
|
|
};
|
2023-01-20 01:40:48 +01:00
|
|
|
|
2022-12-17 19:26:17 +01:00
|
|
|
# tests failed on x86_64-darwin with SIGILL: illegal instruction
|
|
|
|
doCheck = !(stdenv.isx86_64 && stdenv.isDarwin);
|
2021-09-02 11:23:48 +02:00
|
|
|
|
2022-12-18 17:31:02 +01:00
|
|
|
passthru.tests = {
|
|
|
|
inherit (nixosTests) matrix-conduit;
|
|
|
|
};
|
|
|
|
|
2021-09-02 11:23:48 +02:00
|
|
|
meta = with lib; {
|
|
|
|
description = "A Matrix homeserver written in Rust";
|
|
|
|
homepage = "https://conduit.rs/";
|
|
|
|
license = licenses.asl20;
|
2022-02-04 18:32:20 +01:00
|
|
|
maintainers = with maintainers; [ pstn piegames pimeys ];
|
2022-12-17 19:26:17 +01:00
|
|
|
mainProgram = "conduit";
|
2021-09-02 11:23:48 +02:00
|
|
|
};
|
|
|
|
}
|