fix: patchelf binary to link to correct rocksdb

This commit is contained in:
Henry-Hiles
2026-04-07 20:41:19 +00:00
committed by Henry Hiles
parent 3d9fd34012
commit 7643b64f60
+24 -11
View File
@@ -27,28 +27,41 @@
name = "source"; name = "source";
}; };
common = { rocksdb = pkgs.callPackage ./rocksdb.nix { };
attrs = {
inherit src; inherit src;
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
pkg-config pkg-config
rustPlatform.bindgenHook rustPlatform.bindgenHook
]; ];
buildInputs = [ pkgs.liburing ]; buildInputs = [
env.LIBCLANG_PATH = lib.makeLibraryPath [ pkgs.llvmPackages.libclang.lib ]; pkgs.liburing
];
env = {
ROCKSDB_INCLUDE_DIR = "${rocksdb}/include";
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
};
}; };
cargoArtifacts = craneLib.buildDepsOnly common; cargoArtifacts = craneLib.buildDepsOnly attrs;
rocksdb = pkgs.callPackage ./rocksdb.nix { };
in in
{ {
default = craneLib.buildPackage ( default = craneLib.buildPackage (
lib.recursiveUpdate common { lib.recursiveUpdate attrs {
inherit cargoArtifacts; inherit cargoArtifacts;
env = {
ROCKSDB_INCLUDE_DIR = "${rocksdb}/include"; # Needed to make continuwuity link to rocksdb
ROCKSDB_LIB_DIR = "${rocksdb}/lib"; postFixup = ''
}; old_rpath="$(patchelf --print-rpath $out/bin/conduwuit)"
extra_rpath="${
pkgs.lib.makeLibraryPath [
pkgs.rocksdb
]
}"
patchelf --set-rpath "$old_rpath:$extra_rpath" $out/bin/conduwuit
'';
meta = { meta = {
description = "A community-driven Matrix homeserver in Rust"; description = "A community-driven Matrix homeserver in Rust";