AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.
Rust agent-memoryai-agentsbm25claude-codeclicode-searchcursordatabaseelasticsearchfull-text-searchhybrid-searchjsonllocal-firstmcpmcp-servermodel-context-protocolragrustsearch-enginevector-search
feat(packaging): add a Nix flake (#2479) (#2738)
Cristian Groza7aa8d4c9756c
diff --git a/.gitignore b/.gitignoreindex e90c915c3..1fd87044a 100644--- a/.gitignore+++ b/.gitignore@@ -209,3 +209,6 @@ scripts/seo/evidence/# MCP Registry bundle build output (deploy/mcp-registry/build-mcpb.py)/dist/++# nix build output link (flake.nix)+/resultdiff --git a/CHANGELOG.md b/CHANGELOG.mdindex f2b9c48a9..63785b287 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Added+- A Nix flake: `nix run github:xerj-org/xerj` builds and runs `xerj` from+ source, `nix build` produces it, and `nix develop` opens a shell with the+ Rust toolchain. The package builds the engine and embeds the Console assets+ with no network access during the build. (#2479)- `xerj autoindex map --html <FILE>` and `--md <FILE>` export an offlinereport with datasets, format counts, top symbols, graph file hubs,catalog exclusions and suggested searches. `--redact-paths` hides filediff --git a/README.md b/README.mdindex f57bbb04e..37271d699 100644--- a/README.md+++ b/README.md@@ -215,6 +215,12 @@ Windows PowerShell:irm https://xerj.org/get.ps1 | iex```+Nix (builds from source; `nix develop` opens a shell with the Rust toolchain):++```sh+nix run github:xerj-org/xerj -- --version+```+One static binary, no JVM, no dependencies. Prebuilt for Linux, macOS and Windows on x86-64and arm64. The x86-64 builds target x86-64-v2 (SSE4.2: Intel Nehalem 2008 and later, AMDBulldozer and later) and use AVX2 and FMA at runtime when the CPU has them, so a pre-Haswelldiff --git a/flake.lock b/flake.locknew file mode 100644index 000000000..908bdd143--- /dev/null+++ b/flake.lock@@ -0,0 +1,27 @@+{+ "nodes": {+ "nixpkgs": {+ "locked": {+ "lastModified": 1793110635,+ "narHash": "sha256-dhoW6VgFWlaodSY5jrBn+CF2FLmaUvDVgM7+C7T2+NM=",+ "owner": "NixOS",+ "repo": "nixpkgs",+ "rev": "31ecbaca1bdefa45dffc409f0250bd8039ea0010",+ "type": "github"+ },+ "original": {+ "owner": "NixOS",+ "ref": "nixos-unstable",+ "repo": "nixpkgs",+ "type": "github"+ }+ },+ "root": {+ "inputs": {+ "nixpkgs": "nixpkgs"+ }+ }+ },+ "root": "root",+ "version": 7+}diff --git a/flake.nix b/flake.nixnew file mode 100644index 000000000..f1b3f111d--- /dev/null+++ b/flake.nix@@ -0,0 +1,83 @@+{+ description = "XERJ: the search engine for AI agents";++ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";++ outputs =+ { self, nixpkgs }:+ let+ systems = [+ "x86_64-linux"+ "aarch64-linux"+ "x86_64-darwin"+ "aarch64-darwin"+ ];+ forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});+ workspace = (builtins.fromTOML (builtins.readFile ./engine/Cargo.toml)).workspace.package;+ in+ {+ packages = forAllSystems (pkgs: {+ default = self.packages.${pkgs.stdenv.hostPlatform.system}.xerj;+ xerj = pkgs.rustPlatform.buildRustPackage {+ pname = "xerj";+ inherit (workspace) version;++ # The engine, and the Console assets that xerj-console-api's build+ # script embeds from ../../../xerj-ux. Nothing else, so an edit to+ # the docs or the site does not rebuild the binary.+ src = pkgs.lib.fileset.toSource {+ root = ./.;+ fileset = pkgs.lib.fileset.unions [+ ./engine+ ./xerj-ux+ ];+ };+ cargoRoot = "engine";+ buildAndTestSubdir = "engine";+ cargoLock.lockFile = ./engine/Cargo.lock;++ cargoBuildFlags = [+ "-p"+ "xerj-server"+ "--bin"+ "xerj"+ ];+ # The vendored OpenSSL (openssl-src) is built with perl and make.+ nativeBuildInputs = [ pkgs.perl ];+ # The workspace suite binds ports, starts nodes and runs for a long+ # time; CI runs it. The package check is the binary answering below.+ doCheck = false;+ doInstallCheck = true;+ installCheckPhase = ''+ runHook preInstallCheck+ $out/bin/xerj --version+ runHook postInstallCheck+ '';++ meta = {+ description = "Search engine for AI agents: one local binary that indexes code, docs and logs and serves an Elasticsearch-compatible API and an MCP server";+ homepage = "https://xerj.org";+ license = pkgs.lib.licenses.asl20;+ mainProgram = "xerj";+ platforms = systems;+ };+ };+ });++ devShells = forAllSystems (pkgs: {+ default = pkgs.mkShell {+ packages = [+ pkgs.cargo+ pkgs.rustc+ pkgs.rustfmt+ pkgs.clippy+ pkgs.rust-analyzer+ pkgs.perl+ ];+ RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";+ };+ });++ formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);+ };+}