1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{ depot, pkgs, ... }:

# fedisearch — semantic search over fediverse posts.
#
# Phase 0: only the spike exists. It downloads a sentence-transformer, runs it
# through GoMLX's pure-Go backend and asserts the embedding matches a known
# reference vector. Its purpose is to prove the inference stack and the Nix
# build before any application code is written.

let
  goDeps = import ./go-deps.nix { inherit depot pkgs; };
in
{
  spike = depot.nix.buildGo.program {
    name = "fedisearch-spike";
    # chunkdemo.go is deliberately absent: it sits behind a `chunkdemo` build
    # tag and is run with `go run -tags chunkdemo .`, never packaged. buildGo
    # compiles the files listed here directly, without consulting build tags,
    # so including it would collide with spikemain.go over `main`.
    srcs = [ ./spike.go ./spikemain.go ];
    # These mirror spike.go's imports one-for-one. buildGo resolves each import
    # path against this list, so an omission is reported as a "missing foreign
    # dependency" naming the exact file and line.
    deps = [
      goDeps.onnx-gomlx.onnx
      goDeps.onnx-gomlx.onnx.parser
      goDeps.gomlx-compute
      goDeps.gomlx-compute.gobackend
      goDeps.gomlx.core.graph
      goDeps.gomlx.core.tensors
      goDeps.gomlx.ml.model
      goDeps.go-huggingface.tokenizers.api
      goDeps.go-huggingface.tokenizers.hftokenizer
    ];
  };
}