This commit is contained in:
ari committed 2026-06-26 16:10:58 -04:00
1 parent d9cacefa0f
commit 566240b9ca
3 files changed
+8 -307

No files matched your search

-171
View File
@@ -1,171 +0,0 @@
# OpenClaw Integration Setup
✅ **Integration Complete!**
I've successfully added OpenClaw to your nixos-setup with a simple NixOS systemd service. **No Home Manager required** - it's a pure system service.
## Changes Made
### 1. Updated `flake.nix`
- Added `nix-openclaw` as a new input from `github:openclaw/nix-openclaw`
- Configured it to follow your existing `nixpkgs` and `home-manager` versions
- Added `nix-openclaw` to the outputs destructuring
- Passed `nix-openclaw` through to specialArgs for access in modules
### 2. Created `modules/nixos/server/services/openclaw.nix`
A complete NixOS module that provides:
- `skyg.nixos.server.services.openclaw.enable` - enable/disable the service
- `skyg.nixos.server.services.openclaw.port` - gateway port (default: 18789)
- `skyg.nixos.server.services.openclaw.gatewayToken` - authentication token
- `skyg.nixos.server.services.openclaw.user` - service user (default: openclaw)
- `skyg.nixos.server.services.openclaw.logLevel` - log level (debug/info/warn/error)
- `skyg.nixos.server.services.openclaw.package` - custom OpenClaw package
Features:
- ✅ Automatic user/group creation
- ✅ Systemd service management (auto-restart on failure)
- ✅ Security hardening (strict filesystem protection, no new privileges, private tmp)
- ✅ Automatic firewall port opening
- ✅ Journal logging integration
### 3. Updated `modules/nixos/server/services/default.nix`
- Added `./openclaw.nix` to the services imports so it's available system-wide
## How to Use
### 1. Enable on a Host
In your host configuration (e.g., `hosts/hl-minipc3.nix`):
```nix
skyg.nixos.server.services.openclaw = {
enable = true;
port = 18789;
gatewayToken = "your-secret-gateway-token";
logLevel = "info";
};
```
### 2. Manage Configuration
Configuration happens via:
- **Environment variables**: Set via the service `environment` config
- **Config file** (optional): Point to `/etc/openclaw/openclaw.json` via the `configFile` option
- **Default behavior**: Service auto-creates `/var/lib/openclaw` as its working directory
### 3. Apply Changes
```bash
# Rebuild the system
sudo nixos-rebuild switch
# Or if using home-manager:
home-manager switch --flake .#
```
### 4. Verify It's Running
```bash
# Check service status
systemctl status openclaw-gateway
# View logs
journalctl -u openclaw-gateway -f
# Test gateway locally
curl http://localhost:18789/health
```
## Simple Example Configuration
```nix
# In hosts/hl-minipc3.nix or similar
skyg.nixos.server.services.openclaw = {
enable = true;
port = 18789;
gatewayToken = "mySecretToken123";
};
```
That's it! The service will:
- Run as the `openclaw` user
- Listen on port 18789
- Auto-restart if it crashes
- Log to systemd journal
- Protect filesystem access (strict sandbox)
## Multiple Instances
If you want multiple OpenClaw gateways on the same host with different ports:
```nix
# You'd need to duplicate the service with different names
# This is currently not supported by the module but could be extended
# Just ask if you need this!
```
## Debugging
View real-time logs:
```bash
journalctl -u openclaw-gateway -f
```
Check service details:
```bash
systemctl cat openclaw-gateway
```
View environment variables:
```bash
systemctl show -p Environment openclaw-gateway
```
## Architecture
```
flake.nix (nix-openclaw input)
↓
modules/lib.nix (specialArgs)
↓
modules/nixos/server/services/openclaw.nix
↓
systemd.services.openclaw-gateway
↓
/var/lib/openclaw (working directory)
```
## Next Steps
1. Choose a host where you want OpenClaw (e.g., `hl-minipc3`, `hl-bigbox1`)
2. Add the `skyg.nixos.server.services.openclaw` config to that host
3. Set your `gatewayToken` (generate a secure token)
4. Run `nixos-rebuild switch`
5. Monitor with `journalctl -u openclaw-gateway -f`
## Resources
- [nix-openclaw GitHub](https://github.com/openclaw/nix-openclaw)
- [OpenClaw Documentation](https://docs.openclaw.ai/)
- [NixOS Systemd Services](https://nixos.org/manual/nixos/stable/#sec-systemd-services)
## Troubleshooting
**Service won't start:**
```bash
journalctl -u openclaw-gateway -n 50
```
**Port already in use:**
Change the port in your config:
```nix
skyg.nixos.server.services.openclaw.port = 18790;
```
**Package not found:**
The module defaults to `pkgs.openclaw`. If this doesn't exist in nixpkgs yet, use the nix-openclaw flake output:
```nix
skyg.nixos.server.services.openclaw.package = nix-openclaw.packages.${system}.openclaw;
```
(You'd need to pass it through specialArgs or adjust the module)
Generated
+8 -128
View File
@@ -334,24 +334,6 @@
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems_3"
},
"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"
}
},
"fromYaml": {
"flake": false,
"locked": {
@@ -833,53 +815,9 @@
"type": "github"
}
},
"nix-openclaw": {
"inputs": {
"flake-utils": "flake-utils",
"home-manager": [
"home-manager"
],
"nix-openclaw-tools": "nix-openclaw-tools",
"nixpkgs": [
"nixpkgs"
],
"qmd": "qmd"
},
"locked": {
"lastModified": 1782272238,
"narHash": "sha256-S14YkgSz+/z60qhtd/hDsxv2mNPzgoshUlgHLBYWc68=",
"owner": "openclaw",
"repo": "nix-openclaw",
"rev": "6f232e89add5e3ed03f316c224357e73f51d006a",
"type": "github"
},
"original": {
"owner": "openclaw",
"repo": "nix-openclaw",
"type": "github"
}
},
"nix-openclaw-tools": {
"inputs": {
"nixpkgs": "nixpkgs_6"
},
"locked": {
"lastModified": 1778060041,
"narHash": "sha256-tXWkN1VnwFG8XlRqW/e7VwbKnUfyU9tB7YDm9QHJXTY=",
"owner": "openclaw",
"repo": "nix-openclaw-tools",
"rev": "4c1cee3c7eaf68f9de0f756be1484534f5bb5f34",
"type": "github"
},
"original": {
"owner": "openclaw",
"repo": "nix-openclaw-tools",
"type": "github"
}
},
"nixos-hardware": {
"inputs": {
"nixpkgs": "nixpkgs_7"
"nixpkgs": "nixpkgs_6"
},
"locked": {
"lastModified": 1780310866,
@@ -1019,22 +957,6 @@
}
},
"nixpkgs_6": {
"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_7": {
"locked": {
"lastModified": 1767892417,
"narHash": "sha256-8bW3q88CEg2u4hSP66Vf4lpbLonHz7hqDNBMcCY7E9U=",
@@ -1047,7 +969,7 @@
"url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz"
}
},
"nixpkgs_8": {
"nixpkgs_7": {
"locked": {
"lastModified": 1780203844,
"narHash": "sha256-K5sT4jTpGs15ADhviMKNBH38REpPf5Q6mM1+N6cArVE=",
@@ -1088,7 +1010,7 @@
"noctalia",
"nixpkgs"
],
"systems": "systems_4",
"systems": "systems_3",
"treefmt-nix": "treefmt-nix"
},
"locked": {
@@ -1239,32 +1161,6 @@
"type": "github"
}
},
"qmd": {
"inputs": {
"flake-utils": [
"nix-openclaw",
"flake-utils"
],
"nixpkgs": [
"nix-openclaw",
"nixpkgs"
]
},
"locked": {
"lastModified": 1775429264,
"narHash": "sha256-bqIVaNRTa8H5vrw3RwsD7QdtTa0xNvRuEVzlzE1hIBQ=",
"owner": "tobi",
"repo": "qmd",
"rev": "65cd1b3fd02891d1ee0eefa751620918664fa321",
"type": "github"
},
"original": {
"owner": "tobi",
"ref": "v2.1.0",
"repo": "qmd",
"type": "github"
}
},
"quickshell": {
"inputs": {
"nixpkgs": [
@@ -1299,13 +1195,12 @@
"nix-darwin": "nix-darwin",
"nix-flatpak": "nix-flatpak",
"nix-index-database": "nix-index-database",
"nix-openclaw": "nix-openclaw",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_8",
"nixpkgs": "nixpkgs_7",
"nixpkgs-unstable": "nixpkgs-unstable",
"noctalia": "noctalia",
"stylix": "stylix",
"systems": "systems_6"
"systems": "systems_5"
}
},
"stylix": {
@@ -1321,7 +1216,7 @@
"nixpkgs"
],
"nur": "nur",
"systems": "systems_5",
"systems": "systems_4",
"tinted-kitty": "tinted-kitty",
"tinted-schemes": "tinted-schemes",
"tinted-tmux": "tinted-tmux",
@@ -1373,21 +1268,6 @@
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_4": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
@@ -1402,7 +1282,7 @@
"type": "github"
}
},
"systems_5": {
"systems_4": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
@@ -1417,7 +1297,7 @@
"type": "github"
}
},
"systems_6": {
"systems_5": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
-8
View File
@@ -50,12 +50,6 @@
hyprlauncher.url = "github:hyprwm/hyprlauncher";
# Secrets management
agenix.url = "github:ryantm/agenix";
# OpenClaw AI gateway with Nix packaging
nix-openclaw = {
url = "github:openclaw/nix-openclaw";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
};
outputs =
@@ -76,7 +70,6 @@
, nix-index-database
, agenix
, hermes-agent
, nix-openclaw
}:
let
# Libs
@@ -108,7 +101,6 @@
noctalia
nix-index-database
hermes-agent
nix-openclaw
;
};
}