NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.13k stars 14.16k forks source link

Package request: RediSearch #269105

Open amaumene opened 11 months ago

amaumene commented 11 months ago

Project description

A query and indexing engine for Redis, providing secondary indexing, full-text search, vector similarity search and aggregations.

Metadata

amaumene commented 11 months ago

Hi, I have tried to package it myself. This is what I got so far:

{
  pkgs ? import <nixpkgs> {}
}:
pkgs.stdenv.mkDerivation rec {
  pname = "RediSearch";
  version = "2.8.9";

  src = pkgs.fetchFromGitHub {
    repo = "RediSearch";
    owner = "RediSearch";
    rev = "v${version}";
    hash = "sha256-Dz/+nnPSJXDaAh9skw3Jw8elB5QXR8aktyxC4gaSRFM=";
    fetchSubmodules = true;
  };

  buildInputs = [
    pkgs.cmake
    pkgs.python3
    pkgs.pkg-config
    pkgs.git
  ];

  configurePhase = ''
    cmake .
  '';

  buildPhase = ''
    make
  '';

  installPhase = ''
    mkdir -p $out/bin
    mv chord $out/bin
  '';
}

But one of the dependency (fetched via submodules) "VectorSimilarity" depends on https://github.com/google/cpu_features.git and it seems it's not able to fetch it during the build process:

# VectorSimilarity root: /build/source/deps/VectorSimilarity
# VectorSimilarity binroot: /build/source/deps/VectorSimilarity
# VectorSimilarity static build: ON
[ 11%] Creating directories for 'cpu_features-populate'
[ 22%] Performing download step (git clone) for 'cpu_features-populate'
Cloning into 'cpu_features-src'...
fatal: unable to access 'https://github.com/google/cpu_features.git/': Could not resolve host: github.com
Cloning into 'cpu_features-src'...
fatal: unable to access 'https://github.com/google/cpu_features.git/': Could not resolve host: github.com
Cloning into 'cpu_features-src'...
fatal: unable to access 'https://github.com/google/cpu_features.git/': Could not resolve host: github.com
-- Had to git clone more than once: 3 times.
CMake Error at cpu_features-subbuild/cpu_features-populate-prefix/tmp/cpu_features-populate-gitclone.cmake:39 (message):
  Failed to clone repository: 'https://github.com/google/cpu_features.git'

make[2]: *** [CMakeFiles/cpu_features-populate.dir/build.make:102: cpu_features-populate-prefix/src/cpu_features-populate-stamp/cpu_features-populate-download] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/cpu_features-populate.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

CMake Error at /nix/store/jzfa947q6wvkwmy7f3rnll66gzwv9m9s-cmake-3.25.3/share/cmake-3.25/Modules/FetchContent.cmake:1624 (message):
  Build step for cpu_features failed: 2
Call Stack (most recent call first):
  /nix/store/jzfa947q6wvkwmy7f3rnll66gzwv9m9s-cmake-3.25.3/share/cmake-3.25/Modules/FetchContent.cmake:1764:EVAL:2 (__FetchContent_directPopulate)
  /nix/store/jzfa947q6wvkwmy7f3rnll66gzwv9m9s-cmake-3.25.3/share/cmake-3.25/Modules/FetchContent.cmake:1764 (cmake_language)
  /nix/store/jzfa947q6wvkwmy7f3rnll66gzwv9m9s-cmake-3.25.3/share/cmake-3.25/Modules/FetchContent.cmake:1978 (FetchContent_Populate)
  deps/VectorSimilarity/cmake/cpu_features.cmake:9 (FetchContent_MakeAvailable)
  deps/VectorSimilarity/src/VecSim/spaces/CMakeLists.txt:14 (include)

Any help would be appreciated :)

pinn3 commented 11 months ago

The build is sandboxed, so it cannot download anything from the internet. From what I could find, most packages in nixpkgs that use CMake's FetchContent functionality are patched to point towards the Nix store. Example:

https://github.com/NixOS/nixpkgs/blob/36d2c4f0e29217eff99d58c9cde9df6ba4570cb7/pkgs/development/python-modules/blspy/default.nix#L27