From e9bc416b29518c032ef602a57b2d495ad88ba89a Mon Sep 17 00:00:00 2001 From: Shuroii Date: Tue, 1 Jul 2025 20:00:07 +0200 Subject: [PATCH] feat: Use rocksdb fork --- flake.lock | 20 +++++++++++++++++++- flake.nix | 45 ++++++++++++++++++++++++++++++--------------- 2 files changed, 49 insertions(+), 16 deletions(-) diff --git a/flake.lock b/flake.lock index ee6ea4e8..be0bf3de 100644 --- a/flake.lock +++ b/flake.lock @@ -527,6 +527,23 @@ "type": "github" } }, + "rocksdb": { + "flake": false, + "locked": { + "lastModified": 1741308171, + "narHash": "sha256-YdBvdQ75UJg5ffwNjxizpviCVwVDJnBkM8ZtGIduMgY=", + "ref": "v9.11.1", + "rev": "3ce04794bcfbbb0d2e6f81ae35fc4acf688b6986", + "revCount": 13177, + "type": "git", + "url": "https://forgejo.ellis.link/continuwuation/rocksdb" + }, + "original": { + "ref": "v9.11.1", + "type": "git", + "url": "https://forgejo.ellis.link/continuwuation/rocksdb" + } + }, "root": { "inputs": { "attic": "attic", @@ -536,7 +553,8 @@ "flake-compat": "flake-compat_3", "flake-utils": "flake-utils", "nix-filter": "nix-filter", - "nixpkgs": "nixpkgs_6" + "nixpkgs": "nixpkgs_6", + "rocksdb": "rocksdb" } }, "rust-analyzer-src": { diff --git a/flake.nix b/flake.nix index 0e6acea2..ee79a41d 100644 --- a/flake.nix +++ b/flake.nix @@ -15,6 +15,10 @@ flake-utils.url = "github:numtide/flake-utils?ref=main"; nix-filter.url = "github:numtide/nix-filter?ref=main"; nixpkgs.url = "github:NixOS/nixpkgs?ref=nixpkgs-unstable"; + rocksdb = { + url = "git+https://forgejo.ellis.link/continuwuation/rocksdb?ref=v9.11.1"; + flake = false; + }; }; outputs = @@ -50,11 +54,12 @@ buildFlags = [ "library" ]; }; rocksdb = pkgs.rocksdb_9_10.overrideAttrs (oldAttrs: { - # I'm sure there's a really good reason to use the fork, but it fails to build, so we use nixpkgs instead - # src = inputs.rocksdb; + version = "v9.11.1"; + src = inputs.rocksdb; + # We have this already at https://forgejo.ellis.link/continuwuation/rocksdb/commit/a935c0273e1ba44eacf88ce3685a9b9831486155 # Unsetting this so we don't have to revert it and make this nix exclusive - # patches = [ ]; + patches = [ ]; cmakeFlags = pkgs.lib.subtractLists [ @@ -88,19 +93,29 @@ # We use rust-rocksdb via C interface and don't need C++ RTTI "-DUSE_RTTI=0" ]; + + propagatedBuildInputs = with pkgs; [ + bzip2 + lz4 + zstd + ]; + + # Has "tools" which we don't need or use + outputs = [ "out" ]; + + # preInstall hooks has stuff for messing with ldb/sst_dump which we don't need or use + preInstall = ""; + + # + postPatch = '' + # Fix gcc-13 build failures due to missing and + # includes, fixed upstyream sice 8.x + sed -e '1i #include ' -i db/compaction/compaction_iteration_stats.h + sed -e '1i #include ' -i table/block_based/data_block_hash_index.h + sed -e '1i #include ' -i util/string_util.h + sed -e '1i #include ' -i include/rocksdb/utilities/checkpoint.h + ''; }); - - propagatedBuildInputs = with pkgs; [ - bzip2 - lz4 - zstd - ]; - - # Has "tools" which we don't need or use - outputs = [ "out" ]; - - # preInstall hooks has stuff for messing with ldb/sst_dump which we don't need or use - preInstall = ""; }); scopeHost = mkScope pkgsHost;