Repository navigation
Conversation
liangmiQwQ
self-requested a review
October 25, 2026 14:55
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of #1899 (
system-onlymanagement mode for NixOS). Follows #3143.VP_*_MANAGER=system-onlyrestricts Node.js or a package-manager family to the system installation. Shims then use only tools found on PATH: they never fall back to a managed version, download, or reuse a cached managed install. Every other managed entry point fails with a clear error instead of downloading.system-onlyis intentionally undocumented until the remaining paths are covered (vpcommands, reinstall/upgrade dependency installation, and installation-time setup). Without asystem-onlyvariable, nothing changes:yes/no,config.jsonmodes, and the existing installer probe response behave as before.What's Changed
Parsing and safety net
ManagerPreference::SystemOnlymatches only the exact lowercase value. A family variable (VP_PNPM_MANAGER, ...) takes precedence overVP_PM_MANAGER. At run time,system-onlyoverridesconfig.json. The other values still apply only at installation.DisabledBySystemOnlybefore their cache lookups: runtime download, the Node.js version index, package-manager download and binary lookup, and registry version resolution. The error is not an integrity failure.system-onlyfor now:self_setuptreats it like an unknown value.Shims
vp_command::find_external_toolgets anexclude_managedoption. With it, installs under<DATA>/js_runtimeand<DATA>/package_manager, and the fallback-bin directory, never count as the system tool. Paths are compared after canonicalization, so/nix/store/...tools are accepted.EffectiveMode { Managed, SystemFirst, SystemOnly }combines theconfig.jsonshim mode with the environment.dispatch()intoselect_core_tool, which does not exec and can be tested directly. With system-only Node.js, it ignores session overrides,.node-version-style pins, and a managed runtime inherited from a parent shim. A system-only family ignorespackageManagerpins and makes no registry requests.VP_BYPASSpath, the reuse of a tool selected by a parent shim, global package binaries, andvpxglobal binaries follow the same rules. The npm bundled with a managed runtime is treated as part of that runtime./nix/store/...-nodejs/binmatches no PATH entry, so adding it would reorder the user's PATH. Children reach the same tools through PATH or the shims.VP_NODE_MANAGER=system-only requires a system 'node' on PATH, but none was found.Installers and
vp upgradeA
vpthat predates this change would ignoresystem-onlyand download managed tools. Installers andvp upgradetherefore refuse to hand over to such a binary while anysystem-onlyvariable is set.vpanswersVP_SELF_SETUP_SUPPORT_CHECK=system-onlywith a second line,vite-plus-self-setup-system-only. The response to the existing check (vite-plus-self-setup-v1) is unchanged, because released installers compare it exactly.install.sh,install.ps1, andvp_installerprobe with the new value only when asystem-onlyvariable is set. They fail before the legacy installer path, which would download Node.js itself.vp upgradechecks the extracted binary before installing dependencies, andvp upgrade --rollbackchecks the previous version before switching.vp_installertracks the Node.js choice asNodeManager { Enabled, Disabled, SystemOnly }.system-onlytakes precedence over--no-node-managerand cannot be toggled in the menu. When package managers inherit the Node.js choice,system-onlybecomesno, so only an explicit variable makes them system-only.Current limitations (follow-up PRs)
With
system-onlyset, after this PR:node,npm,pnpm, ...) use system tools.vp install,vp run,vp env *, andvpxpackage downloads fail withDisabledBySystemOnlyinstead of using or downloading managed tools.vp upgradewithsystem-onlyexported fails while installing dependencies, for the same reason.system-onlyat installation is not saved yet.Testing
On the current
main:cargo fmt --all -- --check,cargo check --workspace --locked,cargo clippy -- -D warningsandcargo testfor the affected cratesshim_system_first_fallback/system_only_overrides_managed_shims(an unreachable Node.js mirror and registry, checks that no managed install is created and that the child PATH is unchanged), andcommand_self_setup/command_self_setup_system_only_probeBefore rebasing onto the current
main(the only conflict was an import inshim/dispatch.rs):just check,just lint,just test.github/scripts/test-install-bootstrap.sh: all scenarios, including five new system-only scenariosNot run locally:
.github/scripts/test-install-bootstrap.ps1andtest-install-legacy-remote.ps1(CI; no PowerShell locally)Some existing
command_self_setupand shim snapshot cases fail locally on NixOS both before and after this change (same cases); relying on CI for those.