Replace system openclaw with portable flake

This commit is contained in:
2026-02-07 20:46:38 +00:00
parent 5cb9b1f992
commit 55ba34e517
8 changed files with 122 additions and 121 deletions

1
openclaw/.envrc Normal file
View File

@@ -0,0 +1 @@
use flake

61
openclaw/flake.lock generated Normal file
View File

@@ -0,0 +1,61 @@
{
"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"
}
},
"nixpkgs": {
"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": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"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
}

56
openclaw/flake.nix Normal file
View File

@@ -0,0 +1,56 @@
# nix develop
{
description = "OpenClaw dev shell";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.default = pkgs.mkShell {
name = "openclaw-shell";
buildInputs = with pkgs; [
nodejs_22
git
curl
cmake
];
shellHook = ''
echo "🦞 OpenClaw"
echo ""
# Set up local npm prefix to avoid permission issues
export NPM_CONFIG_PREFIX="$PWD/.npm-global"
export PATH="$NPM_CONFIG_PREFIX/bin:$PATH"
# Ensure the prefix directory exists
mkdir -p "$NPM_CONFIG_PREFIX/bin"
# Install openclaw if not already installed
if ! command -v openclaw &> /dev/null; then
echo "📦 Installing OpenClaw..."
npm install -g openclaw
fi
echo ""
echo "Run 'openclaw gateway' to start the gateway"
echo ""
'';
};
}
);
}