Fix nix linkage issues

This commit is contained in:
Vladislav Grechannik 2026-01-30 00:59:05 +01:00 committed by June Strawberry
parent 3398d1730e
commit 5aea9d139b
No known key found for this signature in database

View file

@ -9,6 +9,7 @@
, rocksdb
, removeReferencesTo
, rust
, autoPatchelfHook
, rust-jemalloc-sys-unprefixed
, stdenv
@ -62,11 +63,10 @@ enableLiburing = featureEnabled "io_uring" && !stdenv.hostPlatform.isDarwin;
# own. In order for this to work, we need to set flags on the build that match
# whatever flags tikv-jemalloc-sys was going to use. These are dependent on
# which features we enable in tikv-jemalloc-sys.
rust-jemalloc-sys' = (rust-jemalloc-sys-unprefixed.override {
rust-jemalloc-sys' =
# tikv-jemalloc-sys/unprefixed_malloc_on_supported_platforms feature
unprefixed = true;
}).overrideAttrs (old: {
configureFlags = old.configureFlags ++
rust-jemalloc-sys-unprefixed
.overrideAttrs (old: { configureFlags = old.configureFlags ++
# we dont need docs
[ "--disable-doc" ] ++
# we dont need cxx/C++ integration
@ -77,8 +77,6 @@ rust-jemalloc-sys' = (rust-jemalloc-sys-unprefixed.override {
(if (featureEnabled "jemalloc_stats") then [ "--enable-stats" ] else [ "--disable-stats" ]);
});
buildDepsOnlyEnv =
let
rocksdb' = (rocksdb.override {
jemalloc = lib.optional (featureEnabled "jemalloc") rust-jemalloc-sys';
# rocksdb fails to build with prefixed jemalloc, which is required on
@ -108,8 +106,8 @@ buildDepsOnlyEnv =
# preInstall hooks has stuff for messing with ldb/sst_dump which we dont need or use
preInstall = "";
});
in
{
buildDepsOnlyEnv = {
# https://crane.dev/faq/rebuilds-bindgen.html
NIX_OUTPATH_USED_AS_RANDOM_SEED = "aaaaaaaaaa";
@ -194,14 +192,23 @@ commonAttrs = {
};
in
craneLib.buildPackage ( commonAttrs // {
craneLib.buildPackage ( commonAttrs // rec {
cargoArtifacts = craneLib.buildDepsOnly (commonAttrs // {
env = buildDepsOnlyEnv;
});
buildInputs = (commonAttrs.buildInputs or []) ++ [
rocksdb'
];
nativeBuildInputs = (commonAttrs.nativeBuildInputs or []) ++ [
autoPatchelfHook
];
nativeCheckInputs = [
pkgsBuildHost.libredirect.hook
];
LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs;
preCheck =
let