Skip to content

armgit / xerj

Public Imported from GitHub
0

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.

feat(packaging): add a Nix flake (#2479) (#2738)

Cristian Groza7aa8d4c9756c
diff --git a/.gitignore b/.gitignore
index 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)
+/result
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 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 offline
report with datasets, format counts, top symbols, graph file hubs,
catalog exclusions and suggested searches. `--redact-paths` hides file
diff --git a/README.md b/README.md
index 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-64
and arm64. The x86-64 builds target x86-64-v2 (SSE4.2: Intel Nehalem 2008 and later, AMD
Bulldozer and later) and use AVX2 and FMA at runtime when the CPU has them, so a pre-Haswell
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 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.nix
new file mode 100644
index 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);
+ };
+}