nixpkgs/pkgs/servers/matrix-conduit/default.nix
Winter ffd48ee04d matrix-conduit: use importCargoLock instead of hacky patch
As `cargo vendor` currently doesn't support workspace inherited manifest
values, a patch that replaced the values manually was used as a workaround.

Now that importCargoLock has support for this, and we're probably going
to move towards it anyways, let's switch to it now, as there's a clear
benefit either way.

This also switches to using our copy of SQLite instead of the vendored
one included in `libsqlite3-sys` -- because it's preferred, but also
because it causes the build to fail, now that dependencies are read-only.
2023-03-18 20:34:59 +01:00

58 lines
1.8 KiB
Nix

{ lib, rustPlatform, fetchFromGitLab, pkg-config, sqlite, stdenv, darwin, nixosTests, rocksdb_6_23 }:
rustPlatform.buildRustPackage rec {
pname = "matrix-conduit";
version = "0.5.0";
src = fetchFromGitLab {
owner = "famedly";
repo = "conduit";
rev = "v${version}";
sha256 = "sha256-GSCpmn6XRbmnfH31R9c6QW3/pez9KHPjI99dR+ln0P4=";
};
# 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=";
"ruma-0.7.4" = "sha256-ztobLdOXSGyK1YcPMMIycO3ZmnjxG5mLkHltf0Fbs8s=";
};
};
# 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
'';
nativeBuildInputs = [
rustPlatform.bindgenHook
pkg-config
];
buildInputs = [ sqlite ] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
];
ROCKSDB_INCLUDE_DIR = "${rocksdb_6_23}/include";
ROCKSDB_LIB_DIR = "${rocksdb_6_23}/lib";
# tests failed on x86_64-darwin with SIGILL: illegal instruction
doCheck = !(stdenv.isx86_64 && stdenv.isDarwin);
passthru.tests = {
inherit (nixosTests) matrix-conduit;
};
meta = with lib; {
description = "A Matrix homeserver written in Rust";
homepage = "https://conduit.rs/";
license = licenses.asl20;
maintainers = with maintainers; [ pstn piegames pimeys ];
mainProgram = "conduit";
};
}