SuperAPI AI 工具集

nix-setup

部署与运维

查看项目

更新于 10-15 20:09

技能介绍

用途:在项目里快速搭建基于 Nix flakes(nix-command + flakes)的 dev shell,提供各语言的 flake.nix 与 .envrc 模板,复制到项目根目录即可使用,也覆盖 flake.nix、flake.lock、.envrc 相关问题与 nix develop、nix build 的排障。

主要能力:assets 内含 setup_nix.sh(单用户、sandbox=false 的容器/Claude Code web 安装脚本)、apm.nix、moonbit、rust、typescript、python-uv、haskell、ocaml、oxcaml 模板和 home-manager 多主机配置。所有模板预装 just、ast-grep、apm。

用法:常规环境用 curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install;受限环境执行 bash setup_nix.sh 后 source "$HOME/.nix-profile/etc/profile.d/nix.sh"。模板通过 cp 到项目根目录,然后 nix develop,或写 .envrc 中 use flake 并 direnv allow(推荐 nix-direnv)。

适用场景:新建或改造现有项目的开发环境、容器与 Claude Code web、GitHub Actions 中 nix develop --command just test、以及用 home-manager 声明式管理用户环境。

限制:需 flake 功能开启;容器等环境需 sandbox=false;MoonBit overlay 固定到已知版本;TypeScript 使用顶层 pkgs.pnpm(nodePackages.pnpm 已移除);OxCaml 需手动 opam install oxcaml-dev,构建耗时且占空间;macOS 部分 FFI 需补 zlib;cold start 时间随包增多而延长;秘密信息需自行用 private.nix 或 sops-nix 处理。