diff options
| -rw-r--r-- | configs/hermes.nix | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/configs/hermes.nix b/configs/hermes.nix index 902c280..0cc0736 100644 --- a/configs/hermes.nix +++ b/configs/hermes.nix @@ -47,6 +47,35 @@ let substituteInPlace gateway/run.py --replace-fail \ 'RedactingFormatter("%(asctime)s %(levelname)s %(name)s: %(message)s")' \ 'RedactingFormatter(("" if os.environ.get("JOURNAL_STREAM") else "%(asctime)s ") + "%(levelname)s %(name)s: %(message)s")' + + # Bundled and optional skills get copied out of the store with the + # store's modes, i.e. read-only, so skill_manage can neither patch + # them nor write its temporary files next to them: make the copies + # writable (and the categories' DESCRIPTION.md, without its mode). + # The manifest's hashes are of contents only, so that doesn't make + # them count as user-modified. + substituteInPlace tools/skills_sync.py \ + --replace-fail 'shutil.copytree(src, dest, ignore=_ignore_runtime_cache)' \ + '_copytree_writable(src, dest, ignore=_ignore_runtime_cache)' \ + --replace-fail 'shutil.copytree(skill_src, dest, ignore=_ignore_runtime_cache)' \ + '_copytree_writable(skill_src, dest, ignore=_ignore_runtime_cache)' \ + --replace-fail 'shutil.copy2(desc_md, dest_desc)' \ + 'shutil.copyfile(desc_md, dest_desc)' + substituteInPlace tools/skills_sync_bundled_ops.py \ + --replace-fail 'shutil.copytree(src, dest, ignore=_ignore_runtime_cache, dirs_exist_ok=True,' \ + 'ss._copytree_writable(src, dest, ignore=_ignore_runtime_cache, dirs_exist_ok=True,' + cat >> tools/skills_sync.py <<'EOF' + + + def _copytree_writable(src, dst, **kwargs): + result = shutil.copytree(src, dst, **kwargs) + for root, _dirs, files in os.walk(dst): + for path in [root, *(os.path.join(root, name) for name in files)]: + st = os.lstat(path) + if not stat.S_ISLNK(st.st_mode): + os.chmod(path, st.st_mode | stat.S_IWUSR) + return result + EOF ''; }; |
