feat(openclaw): add openclaw-superpowers extension
- Add openclaw-superpowers as a flake input. - Implement superpowers option in openclaw-podman module. - Automate skill symlinking, state directory creation, and cron registration. - Ensure PyYAML is installed within the container via a post-startup service. - Enable superpowers in the main configuration.
This commit is contained in:
parent
aa670604b5
commit
562ec5526c
4 changed files with 82 additions and 0 deletions
|
|
@ -128,6 +128,7 @@
|
||||||
# === OpenClaw ===
|
# === OpenClaw ===
|
||||||
myModules.openclaw-podman = {
|
myModules.openclaw-podman = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
superpowers.enable = true;
|
||||||
port = 18789;
|
port = 18789;
|
||||||
domain = "openclaw.ashisgreat.xyz";
|
domain = "openclaw.ashisgreat.xyz";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
17
flake.lock
generated
17
flake.lock
generated
|
|
@ -32,9 +32,26 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"openclaw-superpowers": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1773810424,
|
||||||
|
"narHash": "sha256-fGx2ZxjL+SW9e3Iejja0WJV5lLjDkdz6hKXs07EVREc=",
|
||||||
|
"owner": "ArchieIndian",
|
||||||
|
"repo": "openclaw-superpowers",
|
||||||
|
"rev": "db78b90144f966441f1946a910330be02f1cd360",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "ArchieIndian",
|
||||||
|
"repo": "openclaw-superpowers",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
|
"openclaw-superpowers": "openclaw-superpowers",
|
||||||
"sops-nix": "sops-nix"
|
"sops-nix": "sops-nix"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,16 @@
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
sops-nix.url = "github:Mic92/sops-nix";
|
sops-nix.url = "github:Mic92/sops-nix";
|
||||||
|
openclaw-superpowers = {
|
||||||
|
url = "github:ArchieIndian/openclaw-superpowers";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, sops-nix, ... }@inputs: {
|
outputs = { self, nixpkgs, sops-nix, ... }@inputs: {
|
||||||
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
|
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
|
specialArgs = { inherit inputs; };
|
||||||
modules = [
|
modules = [
|
||||||
./configuration.nix
|
./configuration.nix
|
||||||
./modules
|
./modules
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
inputs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
|
@ -22,6 +23,15 @@ in
|
||||||
options.myModules.openclaw-podman = {
|
options.myModules.openclaw-podman = {
|
||||||
enable = lib.mkEnableOption "OpenClaw AI Agent (Podman)";
|
enable = lib.mkEnableOption "OpenClaw AI Agent (Podman)";
|
||||||
|
|
||||||
|
superpowers = {
|
||||||
|
enable = lib.mkEnableOption "openclaw-superpowers extension";
|
||||||
|
src = lib.mkOption {
|
||||||
|
type = lib.types.path;
|
||||||
|
default = inputs.openclaw-superpowers;
|
||||||
|
description = "Path to openclaw-superpowers source";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
port = lib.mkOption {
|
port = lib.mkOption {
|
||||||
type = lib.types.port;
|
type = lib.types.port;
|
||||||
default = 18789;
|
default = 18789;
|
||||||
|
|
@ -53,6 +63,8 @@ in
|
||||||
];
|
];
|
||||||
volumes = [
|
volumes = [
|
||||||
"/var/lib/openclaw:/home/node/.openclaw"
|
"/var/lib/openclaw:/home/node/.openclaw"
|
||||||
|
] ++ lib.optionals cfg.superpowers.enable [
|
||||||
|
"${cfg.superpowers.src}:/home/node/superpowers-src:ro"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -63,6 +75,53 @@ in
|
||||||
cp -f ${./openclaw-config.json} /var/lib/openclaw/openclaw.json
|
cp -f ${./openclaw-config.json} /var/lib/openclaw/openclaw.json
|
||||||
chown -R 1000:1000 /var/lib/openclaw
|
chown -R 1000:1000 /var/lib/openclaw
|
||||||
chmod -R u+rwX /var/lib/openclaw
|
chmod -R u+rwX /var/lib/openclaw
|
||||||
|
|
||||||
|
${lib.optionalString cfg.superpowers.enable ''
|
||||||
|
# Setup openclaw-superpowers
|
||||||
|
mkdir -p /var/lib/openclaw/extensions
|
||||||
|
mkdir -p /var/lib/openclaw/skill-state
|
||||||
|
ln -sfT /home/node/superpowers-src/skills /var/lib/openclaw/extensions/superpowers
|
||||||
|
|
||||||
|
# Replicate install.sh stateful skill registration
|
||||||
|
REPO_SRC="${cfg.superpowers.src}"
|
||||||
|
for skill_file in $REPO_SRC/skills/openclaw-native/*/SKILL.md; do
|
||||||
|
[ -f "$skill_file" ] || continue
|
||||||
|
skill_name=$(basename $(dirname "$skill_file"))
|
||||||
|
|
||||||
|
# Check if stateful: true in frontmatter
|
||||||
|
if sed -n '2,/^---$/p' "$skill_file" | grep -q '^stateful: *true'; then
|
||||||
|
mkdir -p "/var/lib/openclaw/skill-state/$skill_name"
|
||||||
|
if [ ! -f "/var/lib/openclaw/skill-state/$skill_name/state.yaml" ]; then
|
||||||
|
echo "# Runtime state for $skill_name — managed by openclaw-superpowers" > "/var/lib/openclaw/skill-state/$skill_name/state.yaml"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
chown -R 1000:1000 /var/lib/openclaw/extensions /var/lib/openclaw/skill-state
|
||||||
|
''}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# Optional: Install PyYAML inside the container on startup
|
||||||
|
# We do this as a postStart or a simple background loop if needed,
|
||||||
|
# but a better way is to ensure the image has it.
|
||||||
|
# Since we can't easily change the image here, we'll try to run a one-time pip install.
|
||||||
|
systemd.services."openclaw-superpowers-setup" = lib.mkIf cfg.superpowers.enable {
|
||||||
|
description = "One-time setup for OpenClaw superpowers (PyYAML and Cron)";
|
||||||
|
after = [ "podman-openclaw.service" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
ExecStart = "${pkgs.podman}/bin/podman exec -u node openclaw bash -c '\
|
||||||
|
python3 -m pip install --user PyYAML && \
|
||||||
|
for skill_file in /home/node/superpowers-src/skills/openclaw-native/*/SKILL.md; do \
|
||||||
|
[ -f \"$skill_file\" ] || continue; \
|
||||||
|
skill_name=$(basename $(dirname \"$skill_file\")); \
|
||||||
|
fm_cron=$(sed -n \"2,/^---$/p\" \"$skill_file\" | grep \"^cron:\" | sed \"s/^cron: *//\" | tr -d \"'\\\"\"); \
|
||||||
|
if [ -n \"$fm_cron\" ]; then \
|
||||||
|
openclaw cron add \"$skill_name\" \"$fm_cron\" || echo \"Cron add failed for $skill_name\"; \
|
||||||
|
fi; \
|
||||||
|
done'";
|
||||||
|
RemainAfterExit = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue