From b4612537db66fab7d85ee74efdab9d5f817fcfd7 Mon Sep 17 00:00:00 2001
From: levonk <277861+levonk@users.noreply.github.com>
Date: Mon, 25 May 2026 11:24:04 -0700
Subject: [PATCH] feat: add Nix flake and Devbox support
Adds a Nix flake so the project can be installed and run directly
from GitHub without manual compilation:
nix run github:levonk/space-agent
nix profile install github:levonk/space-agent
Adds devbox.json for reproducible development environments:
devbox shell
devbox run install
Also updates README install instructions to include Nix and Devbox.
- Uses Node.js 22 (Node.js 20 is marked as insecure)
- Builds from source using buildNpmPackage
- Includes npmDeps hash for reproducible builds
---
README.md | 43 ++++++++++++++++++++++++++++++++++
devbox.json | 16 +++++++++++++
flake.nix | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 125 insertions(+)
create mode 100644 devbox.json
create mode 100644 flake.nix
diff --git a/README.md b/README.md
index ec541b69..fdc2729c 100644
--- a/README.md
+++ b/README.md
@@ -105,6 +105,49 @@ Grab the latest build from [GitHub Releases](https://github.com/agent0ai/space-a
+#### With Nix (flakes)
+
+```bash
+nix run github:agent0ai/space-agent
+```
+
+Or install permanently:
+
+```bash
+nix profile install github:agent0ai/space-agent
+```
+
+#### With Devbox
+
+```bash
+# Install devbox first (if not already installed)
+curl -fsSL https://get.jetify.dev/devbox | bash
+
+# Clone the repository
+git clone https://github.com/agent0ai/space-agent.git
+cd space-agent
+
+# Initialize the environment
+devbox shell
+
+# Install dependencies
+devbox run install
+
+# create yourself an admin
+node space user create admin --password "change-me-now" --full-name "Admin" --groups _admin
+
+# start the server
+node space serve
+```
+
+Or install devbox via Homebrew:
+
+```bash
+brew install jetify-com/devbox/devbox
+```
+
+#### From source
+
```bash
git clone https://github.com/agent0ai/space-agent.git
cd space-agent
diff --git a/devbox.json b/devbox.json
new file mode 100644
index 00000000..6992fdff
--- /dev/null
+++ b/devbox.json
@@ -0,0 +1,16 @@
+{
+ "$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.12.0/.schema/devbox.schema.json",
+ "packages": [
+ "nodejs_22"
+ ],
+ "shell": {
+ "init_hook": [
+ "echo 'Welcome to the space-agent devbox environment!'"
+ ],
+ "scripts": {
+ "install": "npm install",
+ "start": "node space serve",
+ "dev": "node server/dev_server.js"
+ }
+ }
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 00000000..d329aa6a
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,66 @@
+{
+ description = "Browser-first AI agent with a thin Node.js server";
+
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+ flake-utils.url = "github:numtide/flake-utils";
+ };
+
+ outputs = { self, nixpkgs, flake-utils, ... }:
+ flake-utils.lib.eachDefaultSystem (system:
+ let
+ pkgs = nixpkgs.legacyPackages.${system};
+ space-agent = pkgs.buildNpmPackage {
+ pname = "space-agent";
+ version = "0.36.0";
+ src = ./.;
+
+ npmDeps = pkgs.fetchNpmDeps {
+ src = ./.;
+ hash = "sha256-GvKSULl2i+6pDjrodxFKgeA0FS/jeGnHS+sas8GVj38=";
+ };
+
+ dontNpmBuild = true;
+
+ installPhase = ''
+ mkdir -p $out/bin
+ mkdir -p $out/lib/node_modules/space-agent
+
+ # Copy all source files
+ cp -r . $out/lib/node_modules/space-agent/
+
+ # Create wrapper script
+ cat > $out/bin/space <