Unverified Commit 59f4a8c4 authored by Can H. Tartanoglu's avatar Can H. Tartanoglu
Browse files

surrealdb-surrealkv: init at 2.6.1

parent 92b7b2e0
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
{
  _surrealdbPackage,
  callPackage,
}:
callPackage _surrealdbPackage {
  backend = "surrealkv";
}
+35 −6
Original line number Diff line number Diff line
@@ -7,11 +7,21 @@
  rocksdb,
  testers,
  protobuf,
  backend ? "rocksdb",
}:
let
  hasRocksDB = backend == "rocksdb";
in
assert lib.assertMsg (builtins.elem backend [
  "rocksdb"
  "surrealkv"
]) "surrealdb: backend must be one of [ \"rocksdb\" \"surrealkv\" ]";
rustPlatform.buildRustPackage (finalAttrs: {
  pname = "surrealdb";
  pname = if hasRocksDB then "surrealdb" else "surrealdb-surrealkv";
  version = "2.6.1";

  __structuredAttrs = true;

  src = fetchFromGitHub {
    owner = "surrealdb";
    repo = "surrealdb";
@@ -21,19 +31,34 @@ rustPlatform.buildRustPackage (finalAttrs: {

  cargoHash = "sha256-lebSQPGnxW+3a7vWw3R7QYtHx04/DsRK/n8c/UT3FZo=";

  # error: linker `aarch64-linux-gnu-gcc` not found
  # Upstream hard-codes `aarch64-linux-gnu-gcc` in `.cargo/config.toml`.
  # Remove it so Cargo uses nixpkgs' wrapped C toolchain instead.
  postPatch = ''
    rm .cargo/config.toml
  '';

  buildNoDefaultFeatures = true;
  buildFeatures = [
    "allocator"
    "allocation-tracking"
    "http"
    "scripting"
    "storage-mem"
    "storage-surrealcs"
    # Keep this enabled for the default RocksDB build to preserve upstream's
    # default storage feature set. It can be dropped if `pkgs.surrealdb` is
    # intentionally slimmed to RocksDB-only in a later change.
    "storage-surrealkv"
  ]
  ++ lib.optional hasRocksDB "storage-rocksdb";

  env = {
    PROTOC = "${protobuf}/bin/protoc";
    PROTOC_INCLUDE = "${protobuf}/include";

  }
  // lib.optionalAttrs hasRocksDB {
    ROCKSDB_INCLUDE_DIR = "${rocksdb}/include";
    ROCKSDB_LIB_DIR = "${rocksdb}/lib";

    RUSTFLAGS = "--cfg surrealdb_unstable";
  };

  nativeBuildInputs = [
@@ -60,7 +85,11 @@ rustPlatform.buildRustPackage (finalAttrs: {
  };

  meta = {
    description = "Scalable, distributed, collaborative, document-graph database, for the realtime web";
    description =
      if hasRocksDB then
        "Scalable, distributed, collaborative, document-graph database, for the realtime web"
      else
        "SurrealDB with the SurrealKV storage backend";
    homepage = "https://surrealdb.com/";
    mainProgram = "surreal";
    license = lib.licenses.bsl11;
+2 −0
Original line number Diff line number Diff line
@@ -7948,6 +7948,8 @@ with pkgs;

  home-assistant-cli = callPackage ../servers/home-assistant/cli.nix { };

  _surrealdbPackage = ../by-name/su/surrealdb/package.nix;

  icingaweb2-ipl = callPackage ../servers/icingaweb2/ipl.nix { };
  icingaweb2-thirdparty = callPackage ../servers/icingaweb2/thirdparty.nix { };
  icingaweb2 = callPackage ../servers/icingaweb2 { };