Openclaw flake

This commit is contained in:
2026-02-05 19:50:22 +00:00
parent 89aba25e23
commit 59224e4dde
3 changed files with 239 additions and 0 deletions

24
openclaw/README.md Normal file
View File

@@ -0,0 +1,24 @@
# Openclaw
Development shell for [Openclaw](https://github.com/openclaw/openclaw) with Ollama.
## Usage
```bash
nix develop
```
Auto-starts:
- **ollama** on http://localhost:11434
- **openclaw-gateway** (uses config from `~/.openclaw`)
## Commands
```bash
ollama list # List models
ollama run llama3.2:3b # Chat with model
# Stop services
pkill ollama
pkill openclaw-gateway
```

139
openclaw/flake.lock generated Normal file
View File

@@ -0,0 +1,139 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nix-openclaw",
"nixpkgs"
]
},
"locked": {
"lastModified": 1767909183,
"narHash": "sha256-u/bcU0xePi5bgNoRsiqSIwaGBwDilKKFTz3g0hqOBAo=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "cd6e96d56ed4b2a779ac73a1227e0bb1519b3509",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nix-openclaw": {
"inputs": {
"flake-utils": "flake-utils",
"home-manager": "home-manager",
"nix-steipete-tools": "nix-steipete-tools",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1770307011,
"narHash": "sha256-xrLN4YZtd+AOkGnQqLQ7BW7Ln10X3cvbHYFog9DZTwQ=",
"owner": "openclaw",
"repo": "nix-openclaw",
"rev": "4c4a7cb03bc5f32b0e24b1c466d10fda27fd8af2",
"type": "github"
},
"original": {
"owner": "openclaw",
"repo": "nix-openclaw",
"type": "github"
}
},
"nix-steipete-tools": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1770240566,
"narHash": "sha256-fY8t41kMSHu2ovf89mIdvC7vkceroCwKxw/MKVn4rsE=",
"owner": "openclaw",
"repo": "nix-steipete-tools",
"rev": "983210e3b6e9285780e87f48ce9354b51a270e95",
"type": "github"
},
"original": {
"owner": "openclaw",
"repo": "nix-steipete-tools",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1767364772,
"narHash": "sha256-fFUnEYMla8b7UKjijLnMe+oVFOz6HjijGGNS1l7dYaQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "16c7794d0a28b5a37904d55bcca36003b9109aaa",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1770197578,
"narHash": "sha256-AYqlWrX09+HvGs8zM6ebZ1pwUqjkfpnv8mewYwAo+iM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "00c21e4c93d963c50d4c0c89bfa84ed6e0694df2",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nix-openclaw": "nix-openclaw",
"nixpkgs": "nixpkgs_2"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

76
openclaw/flake.nix Normal file
View File

@@ -0,0 +1,76 @@
{
description = "Openclaw development shell";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nix-openclaw = {
url = "github:openclaw/nix-openclaw";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{ nixpkgs, nix-openclaw, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
overlays = [ nix-openclaw.overlays.default ];
};
in
{
devShells.${system}.default = pkgs.mkShell {
buildInputs = [
pkgs.openclaw-gateway
pkgs.openclaw-tools
pkgs.trash-cli
pkgs.ollama
];
shellHook = ''
# Start ollama service if not already running
if ! pgrep -x "ollama" > /dev/null; then
echo "Starting ollama service..."
ollama serve &>/dev/null &
sleep 2
fi
# Pull model if needed (runs in background)
if ! ollama list 2>/dev/null | grep -q "llama3.2:3b"; then
echo "Pulling llama3.2:3b model (running in background)..."
ollama pull llama3.2:3b &
fi
# Start openclaw-gateway if not already running (uses ~/.openclaw config)
if ! pgrep -f "openclaw-gateway" > /dev/null; then
echo "Starting openclaw-gateway..."
openclaw gateway &>/dev/null &
sleep 1
fi
xdg-open http://127.0.0.1:18789/ &
echo ""
echo "Openclaw development shell"
echo ""
echo "Services:"
echo " ollama - http://localhost:11434"
if pgrep -f "openclaw-gateway" > /dev/null; then
echo " openclaw-gateway - Running"
fi
echo ""
echo "Commands:"
echo " ollama list - List models"
echo " ollama run <model> - Chat with a model"
echo ""
'';
};
# Also expose the packages for direct use
packages.${system} = {
default = pkgs.openclaw;
gateway = pkgs.openclaw-gateway;
tools = pkgs.openclaw-tools;
};
};
}