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

View File

@@ -9,6 +9,7 @@
, rocksdb , rocksdb
, removeReferencesTo , removeReferencesTo
, rust , rust
, autoPatchelfHook
, rust-jemalloc-sys-unprefixed , rust-jemalloc-sys-unprefixed
, stdenv , 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 # 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 # whatever flags tikv-jemalloc-sys was going to use. These are dependent on
# which features we enable in tikv-jemalloc-sys. # 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 # tikv-jemalloc-sys/unprefixed_malloc_on_supported_platforms feature
unprefixed = true; rust-jemalloc-sys-unprefixed
}).overrideAttrs (old: { .overrideAttrs (old: { configureFlags = old.configureFlags ++
configureFlags = old.configureFlags ++
# we dont need docs # we dont need docs
[ "--disable-doc" ] ++ [ "--disable-doc" ] ++
# we dont need cxx/C++ integration # 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" ]); (if (featureEnabled "jemalloc_stats") then [ "--enable-stats" ] else [ "--disable-stats" ]);
}); });
buildDepsOnlyEnv =
let
rocksdb' = (rocksdb.override { rocksdb' = (rocksdb.override {
jemalloc = lib.optional (featureEnabled "jemalloc") rust-jemalloc-sys'; jemalloc = lib.optional (featureEnabled "jemalloc") rust-jemalloc-sys';
# rocksdb fails to build with prefixed jemalloc, which is required on # 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 hooks has stuff for messing with ldb/sst_dump which we dont need or use
preInstall = ""; preInstall = "";
}); });
in
{ buildDepsOnlyEnv = {
# https://crane.dev/faq/rebuilds-bindgen.html # https://crane.dev/faq/rebuilds-bindgen.html
NIX_OUTPATH_USED_AS_RANDOM_SEED = "aaaaaaaaaa"; NIX_OUTPATH_USED_AS_RANDOM_SEED = "aaaaaaaaaa";
@@ -194,14 +192,23 @@ commonAttrs = {
}; };
in in
craneLib.buildPackage ( commonAttrs // { craneLib.buildPackage ( commonAttrs // rec {
cargoArtifacts = craneLib.buildDepsOnly (commonAttrs // { cargoArtifacts = craneLib.buildDepsOnly (commonAttrs // {
env = buildDepsOnlyEnv; env = buildDepsOnlyEnv;
}); });
buildInputs = (commonAttrs.buildInputs or []) ++ [
rocksdb'
];
nativeBuildInputs = (commonAttrs.nativeBuildInputs or []) ++ [
autoPatchelfHook
];
nativeCheckInputs = [ nativeCheckInputs = [
pkgsBuildHost.libredirect.hook pkgsBuildHost.libredirect.hook
]; ];
LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs;
preCheck = preCheck =
let let