guix_mirror_bot pushed a commit to branch master
in repository guix.

commit 6ba3c451309bf3ad9525ec78a0963dd7f8d72d0c
Author: Arun Isaac <[email protected]>
AuthorDate: Sun Feb 8 21:06:25 2026 +0000

    gnu: Add faiss-for-go-faiss.
    
    * gnu/packages/graph.scm (faiss-for-go-faiss): New variable.
    
    Change-Id: I322a8e058ef00771d3987c05a42b03be9fc64cc5
    Modified-by: Sharlatan Hellseher <[email protected]>
    Signed-off-by: Sharlatan Hellseher <[email protected]>
---
 gnu/packages/graph.scm | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/gnu/packages/graph.scm b/gnu/packages/graph.scm
index 79a4947a39..11db0a4af5 100644
--- a/gnu/packages/graph.scm
+++ b/gnu/packages/graph.scm
@@ -574,6 +574,47 @@ vectors of any size, up to ones that possibly do not fit 
in RAM.  It also
 contains supporting code for evaluation and parameter tuning.")
     (license license:bsd-3)))
 
+(define-public faiss-for-go-faiss
+  (let ((commit "608356b7c9630e891ff87cc49cc7bb460c3870d3")
+        (revision "0"))
+    (package
+      (inherit faiss)
+      (name "faiss-for-go-faiss")
+      (version (git-version "1.11.0" revision commit))
+      (source
+       (origin
+         (inherit (package-source faiss))
+         (uri (git-reference
+                (url "https://github.com/blevesearch/faiss";)
+                (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "0m0hyqn9db0xdbvan0lin7xf11dl4xdpjwwpagw01hl4z72w3al0"))))
+      (arguments
+       (substitute-keyword-arguments (package-arguments faiss)
+         ((#:configure-flags flags '())
+          ;; Add -fpermissive to suppress errors about non-conforming code.
+          #~(cons "-DCMAKE_CXX_FLAGS=-fpermissive"
+                  #$flags))
+         ((#:test-exclude test-exclude #f)
+          "Threading.openmp|IVF.list_context")
+         ((#:phases phases #~%standard-phases)
+          #~(modify-phases #$phases
+              (add-after 'unpack 'fix-bugs
+                (lambda _
+                  ;; Add include directory to target.
+                  (substitute* "c_api/CMakeLists.txt"
+                    (("add_library\\(faiss_c [^\n]*" line)
+                     (string-append line "\n"
+                                    "target_include_directories(faiss_c 
PRIVATE ${CMAKE_SOURCE_DIR})\n")))
+                  ;; Do not assign using initializer list.
+                  (substitute* "tests/test_hamming.cpp"
+                    (("\\{na, k, ids_ham_knn.data[^\n]*" all)
+                     (string-append "faiss::int_maxheap_array_t" all)))))))))
+    (description "This package provides an alternative build of Faiss.")
+    (license (list license:bsd-3       ;faiss code
+                   license:expat)))))  ;blevesearch fork
+
 (define-public python-faiss
   (package (inherit faiss)
     (name "python-faiss")

Reply via email to