Convert Openclaw to Podman container
- Use official ghcr.io/openclaw/openclaw image - configure via JSON config file - containerized for better isolation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
11a588a4d9
commit
a595445bd2
6 changed files with 173 additions and 215 deletions
58
modules/openclaw-podman.nix
Normal file
58
modules/openclaw-podman.nix
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
# OpenClaw Podman Module
|
||||
# Provides: AI Agent with Discord integration running in a container
|
||||
#
|
||||
# Usage:
|
||||
# myModules.openclaw-podman = {
|
||||
# enable = true;
|
||||
# port = 18789;
|
||||
# domain = "openclaw.example.com";
|
||||
# };
|
||||
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.myModules.openclaw-podman;
|
||||
in
|
||||
{
|
||||
options.myModules.openclaw-podman = {
|
||||
enable = lib.mkEnableOption "OpenClaw AI Agent (Podman)";
|
||||
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 18789;
|
||||
description = "Gateway port for OpenClaw";
|
||||
};
|
||||
|
||||
domain = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
example = "openclaw.example.com";
|
||||
description = "Public domain for OpenClaw";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Enable podman
|
||||
myModules.podman.enable = true;
|
||||
|
||||
# OpenClaw container
|
||||
virtualisation.oci-containers.containers."openclaw" = {
|
||||
image = "ghcr.io/openclaw/openclaw:latest";
|
||||
ports = [ "127.0.0.1:${toString cfg.port}:8080" ];
|
||||
environmentFiles = [
|
||||
config.sops.templates."openclaw.env".path
|
||||
];
|
||||
volumes = [
|
||||
"${config.sops.templates."openclaw_config.json".path}:/root/.openclaw/config.json:ro"
|
||||
"openclaw-data:/root/.openclaw"
|
||||
];
|
||||
extraOptions = [
|
||||
"--network=host"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue