Add openclaw as a system package (Dangerous)

This commit is contained in:
2026-02-07 16:04:47 +00:00
parent 449afdaa36
commit 5cb9b1f992
8 changed files with 145 additions and 228 deletions

View File

@@ -1,8 +1,9 @@
Use idiomatic nix.
Before making changes, read the appropriate entries of the following manuals:
If needed, read the appropriate entries of the following manuals:
- man configuration.nix
- man home-configuration.nix
- ... among other resources
Do not read the entire manual at once, instead search only for what you need.

View File

@@ -98,6 +98,7 @@
# Packages
nixpkgs.config.allowUnfree = true;
nixpkgs.overlays = [ inputs.nix-openclaw.overlays.default ];
environment.systemPackages = with pkgs; [
git
];
@@ -163,6 +164,27 @@
};
};
# RAM Optimizations (important for AI workloads)
zramSwap = {
enable = true;
algorithm = "zstd";
# Total "virtual" swap size. 100% of RAM is safe for zRAM.
memoryPercent = 100; # Drop to 50% if 64+GB of RAM
};
services.earlyoom = {
enable = true;
# Start killing processes when available RAM drops below 10%
freeMemThreshold = 10; # Drop to 5% if 64+GB of RAM, increase if on <16GB RAM.
# Start killing processes when available swap drops below 10%
freeSwapThreshold = 10;
};
boot.kernel.sysctl = {
"vm.swappiness" = 100;
"vm.vfs_cache_pressure" = 50;
# Helps prevent the system from "stuttering" when it starts swapping
"vm.watermark_boost_factor" = 0;
};
# Open ports in the firewall.
networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [ 11434 ]; # LMStudio (must be manually configured)

114
nixos/flake.lock generated
View File

@@ -1,5 +1,23 @@
{
"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": [
@@ -20,7 +38,85 @@
"type": "github"
}
},
"home-manager_2": {
"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_2",
"nix-steipete-tools": "nix-steipete-tools",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1770414328,
"narHash": "sha256-qjZ+5Kx/EKCaEWeOlxyMzmZRUZCUAa74PiCbNrok4Qc=",
"owner": "openclaw",
"repo": "nix-openclaw",
"rev": "287c9a34c6a5d9928c986556064ec1e4d189e11c",
"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": 1769461804,
"narHash": "sha256-msG8SU5WsBUfVVa/9RPLaymvi5bI8edTavbIq3vRlhI=",
@@ -39,7 +135,23 @@
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
"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"
}
}
},

View File

@@ -8,6 +8,11 @@
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-openclaw = {
url = "github:openclaw/nix-openclaw";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =

View File

@@ -56,7 +56,8 @@
# AI
lmstudio
nodejs
openclaw-gateway
openclaw-tools
# Scripts
(pkgs.writeShellScriptBin "colors" ''
@@ -413,6 +414,7 @@
"_processor_usage_"
"_gpu#1_usage_"
"_memory_usage_"
"_swap_usage_"
"__temperature_max__"
];
icon-style = 1;

View File

@@ -1,24 +0,0 @@
# 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
View File

@@ -1,139 +0,0 @@
{
"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
}

View File

@@ -1,62 +0,0 @@
{
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
];
shellHook = ''
# Start openclaw-gateway if not already running (uses ~/.openclaw config)
if ! pgrep -f "openclaw-gateway" > /dev/null; then
echo "Starting openclaw-gateway..."
openclaw gateway &
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;
};
};
}