Conversation
📝 WalkthroughWalkthroughRefactors builtins.getFlake to branch on argument type (path vs non-path) with shared LockFlags preparation, and adds two new lockFlake overloads (FlakeRef and SourcePath) that delegate to a primary overload accepting an explicit Flake. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/libflake/flake.cc`:
- Around line 959-962: The overload of lockFlake that constructs a fakeRef via
parseFlakeRef("flake:dummy") causes topRef.input.getSourcePath() to be null and
prevents writing lockfiles for local flakes; change the overload (the function
that currently creates fakeRef and calls readFlake) to detect when flakeDir is a
local/rootFS path and construct a path-based FlakeRef whose input.sourcePath is
flakeDir (instead of parseFlakeRef("flake:dummy")), or alternatively ensure
callers pass writeLockFile=false or an explicit outputLockFilePath; update the
call site that uses fakeRef, readFlake, and lockFlake to use the new path-based
FlakeRef so writeLockFile logic can find a valid topRef.input.getSourcePath().
🧹 Nitpick comments (1)
src/libexpr/primops.cc (1)
2371-2374: Avoid double symlink resolution in__narHash.
realisePathalready defaults to full symlink resolution, so resolving again adds extra I/O. Consider passingpathdirectly tofetchToStore2.♻️ Proposed tweak
- auto hash = - fetchToStore2(state.fetchSettings, *state.store, path.resolveSymlinks(), FetchMode::DryRun).second; + auto hash = + fetchToStore2(state.fetchSettings, *state.store, path, FetchMode::DryRun).second;
b6c29e1 to
6836c75
Compare
6836c75 to
fd9e438
Compare
This allows doing `builtins.getFlake ./subflake` instead of ugly hacks.
fd9e438 to
c80220e
Compare
Motivation
This allows doing
instead of the hacky
Depends on #337.
Issue #302.
Context
Summary by CodeRabbit
New Features
Refactor
Tests