nimble develop shadowing installed packages: limiting nimble.paths entries to one project
0 reputation · 17 Jun 2026, 21:49 UTC
0 reputation · 17 Jun 2026, 21:49 UTC
I am using nimble develop to co-develop two interdependent Nim packages. The documented workflow clones the dependencies locally and adds them to nimble.paths, so local edits are compiled instead of the installed copies. That works, but the paths file appears to be global rather than project-scoped.
My concern is the permission boundary: once a package is in nimble.paths, unrelated projects on the same machine may silently compile against my in-development checkout instead of the pinned version from their lock file. I want the develop setup to apply only when building inside the one project directory, and to be safely reversible without hand-editing files.
Assume a recent Nimble release (I will confirm exact semantics with nimble -v and the installed README, since this behavior has changed across versions).
Specifically:
nimble develop path entries to a single project, or is the global nimble.paths mutation the only documented mechanism?nimble.lock still be honored for dependencies currently listed in nimble.paths, or does the develop path always win?35775 reputation · 18 Jun 2026, 07:22 UTC
There is no built-in project-scoped mode for nimble develop. The command appends entries to the global nimble.paths file (typically ~/.config/nimble/nimble.paths), and every nimble invocation on that machine consults it. While a package is listed there, the develop checkout wins over both installed copies and nimble.lock pins. The supported escape hatch is to redirect the paths file itself per session, so the global file stays untouched.
Confirmed by the documented mechanism: nimble develop is a global mutation by design — it exists so that any build picks up your local checkouts. What is less certain, and what you should verify against your installed version (nimble -v and the shipped README), is the exact precedence wording, because path/lock interaction has shifted across Nimble releases. Treat the details below as version-sensitive.
Since the file location is the only lever, point nimble at a project-local paths file for the shell where you work:
cd ~/src/my-project
export NIMBLE_PATHS="$PWD/.nimble.paths"
touch "$NIMBLE_PATHS"
nimble develop ../lib-a ../lib-b # entries land in ./.nimble.paths
nimble buildKey points:
.envrc so it activates on cd and clears on exit). Exporting it globally recreates the same leak you are trying to avoid.nimble --paths=... build) if your version supports the flag — check nimble --help..nimble.paths to .gitignore; it is machine-local state.Use the built-in undo rather than hand-editing:
nimble develop --undo lib-a # remove one entry
nimble develop --undo all # remove every develop entryWith NIMBLE_PATHS still set, undo edits your project-local file. If you used the global file, undo removes the lines there. Either way, afterwards the dependency resolves from nimble.lock or the installed package again.
Expect the develop path to win unconditionally while the entry exists — that is the entire point of the feature. So a nimble.lock pin for lib-a is ignored until you undo the entry. This also means CI and other developers (who never ran develop) still build against the lock file, which is the behavior you want.
cat "$NIMBLE_PATHS" after develop — entries present; after --undo — gone.nimble show lib-a (or inspect build output paths) before and after undo to confirm which source tree is compiled.One caveat: if you undo an entry while another project was (intentionally or not) building against that checkout, it silently reverts to the locked version. The one missing detail that would change this advice is your exact Nimble version — if --paths/NIMBLE_PATHS behaves differently there, fall back to a dedicated shell with the env var, which is the most portable approach.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.