- Drops --network=host from OpenClaw container - Container now runs on Podman's default bridge network - Gateway port already mapped via ports config (127.0.0.1:18789:8080) - Container retains outbound internet access for Discord API, model providers, etc. - Cannot reach other host services (Forgejo, Vaultwarden, etc.) — principle of least privilege Note: If OpenClaw needs to reach local services in the future, add explicit extraOptions like --network=bridge or create a shared Podman network.
55 lines
1.3 KiB
Nix
55 lines
1.3 KiB
Nix
# OpenClaw Podman Module
|
|
# Provides: AI Agent with Discord integration running in an isolated 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 (bridge network — isolated from host services)
|
|
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 = [
|
|
"${./openclaw-config.json}:/home/node/.openclaw/openclaw.json:ro"
|
|
"openclaw-data:/home/node/.openclaw"
|
|
];
|
|
};
|
|
};
|
|
}
|