Nix Workflow
Quick Reference
- •Development:
direnv allowloads environment automatically - •Build CLI:
nix buildornix build .#cli - •Build All:
nix build .#bundle
Development Environment
bash
# First time setup direnv allow # Verify environment which cargo # Should point to Nix store which node # Should point to Nix store
Build Targets
| Target | Command | Output |
|---|---|---|
| CLI only | nix build | result/bin/novelsaga |
| Full bundle | nix build .#bundle | CLI + WASM + .so |
Hash Update Process
When pnpm-lock.yaml changes:
- •
Set placeholder in
packages.nix:nixhash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
- •
Get correct hash:
bashnix build .#bundle 2>&1 | grep "got:"
- •
Update
packages.nixwith new hash
Troubleshooting
| Issue | Solution |
|---|---|
| Hash mismatch | Update pnpmDeps hash |
| Nightly features error | Ensure fenix overlay active |
| rust-analyzer not working | Run direnv allow, reload VSCode |
When to Use
Load this skill when:
- •Modifying
flake.nix,packages.nix - •Running Nix builds
- •Troubleshooting environment issues