Make rocksdb include liburing, and tell gcc the path during the build

With: strings /nix/store/9skicdac6xs4yww1nd3h7m6xydv4hxlj-rocksdb-9.1.1/lib/librocksdb.so.9|rg io_uring|wc -l
112
With: strings result/bin/conduit |rg io_uring|wc -l
5

Without: strings static-x86_64-unknown-linux-musl-jemalloc |rg io_uring | wc -l
0

Signed-off-by: morguldir <morguldir@protonmail.com>
This commit is contained in:
morguldir 2024-05-06 20:59:59 +02:00 committed by June 🍓🦴
parent 1d57e14dc0
commit 70047ff26d
3 changed files with 39 additions and 1 deletions

18
flake.lock generated
View file

@ -171,6 +171,23 @@
"type": "github"
}
},
"liburing": {
"flake": false,
"locked": {
"lastModified": 1716398759,
"narHash": "sha256-fDlOR13WmwVgMxGUMQXWSZAoy2VhZ5AfZRPF9qmQjSc=",
"owner": "axboe",
"repo": "liburing",
"rev": "49be3cad491ae8b3c40348b8d78ae2b0d3726b78",
"type": "github"
},
"original": {
"owner": "axboe",
"ref": "master",
"repo": "liburing",
"type": "github"
}
},
"nix-filter": {
"locked": {
"lastModified": 1710156097,
@ -260,6 +277,7 @@
"fenix": "fenix",
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_2",
"liburing": "liburing",
"nix-filter": "nix-filter",
"nixpkgs": "nixpkgs_2",
"rocksdb": "rocksdb"

View file

@ -10,6 +10,7 @@
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
# https://github.com/girlbossceo/rocksdb/commit/db6df0b185774778457dabfcbd822cb81760cade
rocksdb = { url = "github:girlbossceo/rocksdb?ref=v9.1.1"; flake = false; };
liburing = { url = "github:axboe/liburing?ref=master"; flake = false; };
};
outputs = inputs:
@ -41,6 +42,12 @@
(builtins.fromJSON (builtins.readFile ./flake.lock))
.nodes.rocksdb.original.ref;
});
# liburing's configure file is handwritten so the default assumptions don't apply
liburing = pkgs.liburing.overrideAttrs {
dontAddStaticConfigureFlags = true;
dontDisableStatic = true;
configureFlags = [];
};
});
scopeHost = mkScope pkgsHost;

View file

@ -3,6 +3,7 @@
, inputs
, lib
, libiconv
, liburing
, pkgsBuildHost
, rocksdb
, rust
@ -57,6 +58,8 @@ rust-jemalloc-sys' = (rust-jemalloc-sys.override {
buildDepsOnlyEnv =
let
uring = featureEnabled "io_uring";
extraDeps = lib.optionals uring [pkgsBuildHost.liburing.dev pkgsBuildHost.liburing.out];
rocksdb' = (rocksdb.override {
jemalloc = rust-jemalloc-sys';
# rocksdb fails to build with prefixed jemalloc, which is required on
@ -70,6 +73,7 @@ buildDepsOnlyEnv =
# TODO: static rocksdb fails to build on darwin
# build log at <https://girlboss.ceo/~strawberry/pb/JjGH>
meta.broken = stdenv.hostPlatform.isStatic && stdenv.isDarwin;
propagatedBuildInputs = old.propagatedBuildInputs ++ extraDeps;
});
in
{
@ -89,7 +93,16 @@ buildDepsOnlyEnv =
buildPackageEnv = {
CONDUWUIT_VERSION_EXTRA = inputs.self.shortRev or inputs.self.dirtyShortRev or "";
} // buildDepsOnlyEnv;
} // buildDepsOnlyEnv // {
CARGO_BUILD_RUSTFLAGS =
let
uring = default_features || builtins.elem "io_uring" features;
in
buildDepsOnlyEnv.CARGO_BUILD_RUSTFLAGS
+ lib.optionalString uring " -L${pkgsBuildHost.liburing}/lib/ -luring";
};
commonAttrs = {
inherit