mirror of
https://github.com/harivansh-afk/nix.git
synced 2026-04-15 05:02:10 +00:00
Openclaw openclaw nix (#64)
* openclaw -> openclaw.nix * skip bootstrap = false * model cnf
This commit is contained in:
parent
a2c87bed8f
commit
72ee43c0db
6 changed files with 187 additions and 106 deletions
|
|
@ -1,36 +1,35 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
inputs,
|
||||
pkgs,
|
||||
hostConfig,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
openClawStateDir = "${config.home.homeDirectory}/.openclaw";
|
||||
openClawWorkspaceDir = "${openClawStateDir}/workspace";
|
||||
openClawVersion = "2026.4.2";
|
||||
npmDir = "${config.xdg.dataHome}/npm";
|
||||
in
|
||||
lib.mkIf hostConfig.isLinux {
|
||||
home.packages = [
|
||||
inputs.openClaw.packages.${pkgs.stdenv.hostPlatform.system}.default
|
||||
];
|
||||
|
||||
home.activation.installOpenClaw = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
export PATH="${
|
||||
lib.makeBinPath [
|
||||
pkgs.nodejs_22
|
||||
pkgs.coreutils
|
||||
]
|
||||
}:$PATH"
|
||||
export PATH="${lib.makeBinPath [ pkgs.nodejs_22 pkgs.coreutils ]}:$PATH"
|
||||
export NPM_CONFIG_USERCONFIG="${config.xdg.configHome}/npm/npmrc"
|
||||
export XDG_DATA_HOME="${config.xdg.dataHome}"
|
||||
export XDG_CACHE_HOME="${config.xdg.cacheHome}"
|
||||
|
||||
OPENCLAW_DIR="${npmDir}/lib/node_modules/openclaw"
|
||||
INSTALLED=$(npm ls -g openclaw --depth=0 --json 2>/dev/null | ${pkgs.jq}/bin/jq -r '.dependencies.openclaw.version // empty')
|
||||
if [ "$INSTALLED" != "${openClawVersion}" ]; then
|
||||
npm install -g "openclaw@${openClawVersion}" 2>/dev/null || true
|
||||
HEALTHY=true
|
||||
[ "$INSTALLED" != "${openClawVersion}" ] && HEALTHY=false
|
||||
[ ! -d "$OPENCLAW_DIR/node_modules/grammy" ] && HEALTHY=false
|
||||
if [ "$HEALTHY" = false ]; then
|
||||
npm install -g "openclaw@${openClawVersion}" --force 2>/dev/null || true
|
||||
fi
|
||||
'';
|
||||
|
||||
home.activation.syncOpenClawState = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
install -d -m 700 "${openClawStateDir}" "${openClawWorkspaceDir}"
|
||||
install -m 600 ${../config/openclaw/openclaw.json} "${openClawStateDir}/openclaw.json"
|
||||
install -m 644 ${../config/openclaw/SOUL.md} "${openClawWorkspaceDir}/SOUL.md"
|
||||
'';
|
||||
home.file.".openclaw/workspace/SOUL.md".source = ../config/openclaw/SOUL.md;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue