可用于管理云主机上的 Ubuntu 用户环境,通过三层结构(hosts、profiles、modules)组织配置,支持快速引导新服务器、手动应用 Home Manager 配置及安装外部 CLI 工具,含模型代理检查脚本。【此简介由AI生成】
Access rate limit exceeded. Please log in to continue.
cloud_server
Nix flake repository for managing the ucloud headless host as a fully declarative NixOS system plus the zhanghong user environment.
The repository is organized around four layers:
nixosConfigurations: full-system host entrypointshosts/: concrete machine entrypointsprofiles/: reusable role-level compositionsmodules/: focused Home Manager building blocks
The current managed host is ucloud. Its primary NixOS user is zhanghong.
If a live host was renamed from ubuntu before a fresh Home Manager switch completed, use scripts/repair-home-manager-after-user-rename.sh once to rewrite the remaining session and user-service residues to zhanghong.
Quick Start
Bootstrap a fresh Ubuntu-based server:
cd ~/env/cloud_server
bash scripts/bootstrap-nix-home.sh
When the script runs without an explicit flake target, it first looks for a Home Manager output matching the current user, then falls back to ucloud.
Apply the managed Home Manager configuration manually:
nix run .#home-manager -- switch --flake .#ucloud
On the managed NixOS host, nix-command and flakes are expected to be enabled system-wide. If nix flake ... still errors about experimental features, the live system is older than the current nixosConfigurations.ucloud generation and needs a switch.
The flake now tracks the stable 25.11 release line for nixpkgs and Home Manager.
home.stateVersion remains 24.05 intentionally so Home Manager stateful behavior only changes during an explicit migration.
The same flake also exports nixosConfigurations.ucloud for full-system installation. The current preferred cutover path is either:
- raw
nixos-anywheredirectly from a trusted local Linux machine scripts/bootstrap-installer-workbench.sh+scripts/install-ucloud-onbox.shfrom a NixOS installer or rescue shell on the VPS
Bootstrap sops + age before the first switch, or on a host whose current Home Manager generation is stale:
bash scripts/with-secrets-tooling.sh sops secrets/xray/config.json
Optionally install external npm-based CLIs that are not yet packaged in this flake:
bash scripts/install-external-clis.sh
That bundle currently installs codex, pi, and cursor-cli into ~/.npm-global/bin.
opencode is managed declaratively by this flake via pkgs.opencode, so on NixOS hosts you should prefer nix run .#home-manager -- switch --flake .#ucloud instead of reinstalling it from npm.
pi comes from @mariozechner/pi-coding-agent and is available for manual evaluation first; the accountable openclaw-run executor path still keeps aider-chat as the legacy non-Codex option until a dedicated Pi wrapper is added.
Quick-check an OpenAI-compatible model proxy before buying:
python3 scripts/check-model-proxy.py --api OAI api-a.example.com api-b.example.com api-c.example.com --api-key "$OPENAI_API_KEY"
Create an accountable slow-path run for Codex:
bash scripts/openclaw-run.sh create --workspace ~/env/cloud_server --spec "在当前仓库实现 xxx"
bash scripts/openclaw-run.sh approve latest --by "manual"
bash scripts/openclaw-run.sh run latest --sandbox workspace-write
bash scripts/openclaw-run.sh status latest
Create the same accountable run shape for Aider when you have explicit target files:
bash scripts/openclaw-run.sh create --workspace ~/env/cloud_server --executor-kind aider-chat --target README.md --spec "更新 README 里的运行示例"
bash scripts/openclaw-run.sh approve latest --by "manual"
bash scripts/openclaw-run.sh run latest --mode tmux --sandbox workspace-write
Repository Layout
.
├── .agents/
├── flake.nix
├── hosts/
├── lib/
├── modules/
├── profiles/
├── secrets/
├── scripts/
├── docs/
└── conf_backup/
docs/architecture.md: repository structure and design intentdocs/bootstrap.md: first-time setup and daily commandsdocs/openclaw/web-operator-workbench.md: discussion draft for the OpenClaw Web operator workbenchdocs/openclaw/web-operator-workbench-playbook.md: accountable delivery playbook for the first workbench iterationdocs/openclaw/web-operator-workbench-v1-contract.md: executable v1 contract for the first workbench iterationdocs/openclaw/codex-skills-strategy.md: strategy for repo-managed Codex skills and upstream superpowers adoptiondocs/runbooks/openclaw.md: OpenClaw deployment and operations on headless hostsdocs/runbooks/ucloud.md: ucloud-specific operational notes, including NixOS migration.agents/skills/: repo-managed Codex skills for accountable run planning, bounded implementation, and run closurescripts/openclaw-run.sh: minimal accountable run state machine for slow-path Codex workscripts/run-codex-task.sh:codex exec --jsonwrapper that persists run artifactsscripts/run-aider-task.sh:aiderwrapper that persists the same run artifactsdocs/secrets.md: encrypted secret storage and editing workflowdocs/runbooks/ucloud.md: ucloud-specific operational notesconf_backup/: manual backups only, not the source of truth for managed state
Maintenance Principles
- Keep
mainas the single long-lived branch. - Add new hosts by composing existing modules instead of copying entire configs.
- Keep imperative bootstrap and operational steps in
scripts/anddocs/. - Store durable secrets in
secrets/withsops, not inconf_backup/. - Do not put runtime-generated auth files into the repository.
Introduction
可用于管理云主机上的 Ubuntu 用户环境,通过三层结构(hosts、profiles、modules)组织配置,支持快速引导新服务器、手动应用 Home Manager 配置及安装外部 CLI 工具,含模型代理检查脚本。【此简介由AI生成】
Customize your domain