Skip to content

Conversation

@burke
Copy link
Member

@burke burke commented Dec 5, 2025

No description provided.

burke and others added 6 commits December 5, 2025 15:23
Introduce five new builtins that provide native access to files from a
git repository during Nix evaluation, replacing the need to shell out
to git via derivations:

- builtins.worldTreeSha: Get tree SHA for a world path
- builtins.worldTree: Fetch a tree by SHA as a store path
- builtins.worldFile: Read file contents from world repository
- builtins.worldZoneSrc: Get zone source as store path
- builtins.worldDir: List directory contents

New CLI flags:
- --world-git-dir: Path to git directory
- --world-sha: Git commit SHA to use
- --world-checkout-path: Optional checkout for source-available mode

Features:
- Lazy initialization of git resources
- Tree SHA caching at each path level
- Source-available mode for local development (prefers checkout files)
- Zone dirty detection for uncommitted changes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Bug fixes:
- Add getCommitTree() to resolve commit SHA to root tree SHA
- Fix worldTreeSha/worldZoneSrc which were passing commit SHA where
  tree SHA was expected, causing "type does not match" errors

New builtins:
- worldManifest: Returns parsed //.meta/manifest.json as attrset
- worldFile: Read file by full path (e.g. "//areas/tools/dev/zone.nix")
- worldZoneFile: Read file by zone + relative path (old worldFile behavior)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- worldManifest now returns path -> zoneId (lifted from path -> {id: zoneId})
- Add worldManifestInverted for zoneId -> path lookups
- Extract readManifestContent helper to share manifest reading logic

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Implements first-class world path syntax where //areas/tools/dev is a
distinct value type (worldpath) that resolves against the world accessor.

Features:
- New nWorldPath value type with WorldPathData storage
- Lexer patterns for //path syntax with interpolation support
- ExprWorldPath AST node for evaluation
- World paths work with builtins: readFile, pathExists, readDir,
  readFileType, import
- builtins.typeOf returns "worldpath"
- builtins.isWorldPath for type checking
- String coercion returns the path string (e.g., "//areas/tools/dev")

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
When copyToStore is true (e.g., in derivation attributes), world paths
are now properly extracted to the Nix store, just like regular paths.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
When world paths are coerced to strings (e.g., "${//path}"), they are
now tracked in the string context with a WorldZone element that includes
the original world path.

Changes:
- Add WorldZone variant to NixStringContextElem (encoded as @zone@path)
- When copying world paths to store, add WorldZone context instead of
  Opaque context
- Update __getContext to expose worldZone attribute showing the source
- Update all std::visit sites to handle the new variant

Example:
  __getContext "${//areas/tools/dev/zone.nix}"
  => { "/nix/store/...-zone.nix" = { path = true; worldZone = "//areas/tools/dev/zone.nix"; }; }

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant