Skip to content

vite-plus: init at 1.1.0 - #533925

Open
fengmk2 wants to merge 3 commits into
NixOS:masterfrom
fengmk2:vite-plus-init
Open

fengmk2 wants to merge 3 commits into
NixOS:masterfrom
fengmk2:vite-plus-init

Conversation

@fengmk2

@fengmk2 fengmk2 commented Jun 21, 2026 •

Copy link
Copy Markdown

Adds vite-plus, the unified toolchain CLI (vp) for web development at 1.1.0. It manages Node.js runtimes, package managers, and the frontend toolchain in one place.

The package builds the vp binary from source. Its JavaScript subcommands (vp create, vp run, ...) resolve a toolchain at <prefix>/node_modules/vite-plus/dist, which fetchNpmDeps supplies from a lockfile. Those dependencies include prebuilt native bindings (rolldown, oxc, oxlint, and oxfmt), hence the binaryNativeCode provenance.

Build workarounds

Comments in package.nix explain each workaround:

  • Drop the packages/cli/binding member and the rolldown/string_wizard path dependencies. The source tarball excludes the externally synced Rolldown tree; no remaining vp_* crate depends on it.
  • Strip artifact dependency annotations from the vite-task Git dependency so stable Cargo can run cargo metadata during vendoring without -Z bindeps.
  • Remove nightly dependency tracking from materialized_artifact_macros. Nix builds use immutable inputs and do not need incremental macro tracking.
  • Stub the fspy preload library because its artifact dependencies require unstable Cargo features. Also skip the fspy build-time download of macOS helper binaries.
  • Drop the seccompiler dependency's rust-vmm-ci submodule from the vendor directory. Its filenames differ only in case, so case-insensitive stores produce a different cargoHash.
  • Default Node.js to system-first with a patch. Downloaded Node.js binaries cannot run on NixOS without a compatible loader, so vp uses the Nix-provided node on PATH. Package managers retain managed mode to respect project version requirements; vp env on re-enables managed Node.js.
  • Supply .vp-setup-complete to prevent automatic setup on first use, and include the vpr and vpx aliases.
  • Make copied project templates writable outside the Nix store.

Limitations

Things done

  • Built on platform(s):
    • x86_64-linux
    • aarch64-linux (evaluated only)
    • x86_64-darwin (unsupported by current Nixpkgs)
    • aarch64-darwin
  • Tested basic functionality (vp --version, vp --help, and vp create) and native bindings on aarch64-darwin and x86_64-linux.
  • The enabled tests and versionCheckHook pass on both built platforms. Network/runtime and environment-sensitive tests remain filtered via checkFlags.
  • Fits CONTRIBUTING.md, pkgs/README.md, and maintainers/README.md.

Assisted-by: Claude Code (Claude Opus 4.8), Codex (GPT-6)

@fengmk2

fengmk2 commented Jun 21, 2026

Copy link
Copy Markdown
Author

cc @qweered

@nixpkgs-ci nixpkgs-ci Bot added 8.has: package (new) This PR adds a new package 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 12.first-time contribution This PR is the author's first one; please be gentle! 9.needs: reviewer This PR currently has no reviewers requested and needs attention. labels Jun 21, 2026
@qweered

qweered commented Jun 21, 2026 •

Copy link
Copy Markdown
Contributor

New packages couldn't be added without a maintainer, see pkgs/Readme.md

@fengmk2 fengmk2 mentioned this pull request Jun 22, 2026
1 task done
@fengmk2

This comment was marked as resolved.

@dotlambda dotlambda left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fengmk2
fengmk2 force-pushed the vite-plus-init branch 2 times, most recently from eddde1e to ad18d9a Compare June 22, 2026 02:45
@nixpkgs-ci nixpkgs-ci Bot added 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` and removed 9.needs: reviewer This PR currently has no reviewers requested and needs attention. labels Jun 22, 2026
@ethancedwards8 ethancedwards8 added the llm-assisted Contributions that include code generation with LLMs label Jul 18, 2026
@ryoppippi

Copy link
Copy Markdown
Member

any progress? i can handle it if you want

naitokosuke added a commit to naitokosuke/dotfiles that referenced this pull request Jul 23, 2026
- Track the official prebuilt vp-aarch64-apple-darwin.tar.gz release
  asset in nvfetcher.toml (the Nix equivalent of upstream's curl
  installer); install it via a thin pkgs/vite-plus.nix like ax/vize
- Drop the vp-nix flake input; TODO recorded in pkgs/vite-plus.nix to
  switch to pkgs.vite-plus once NixOS/nixpkgs#533925 lands
- Sync README and docs walkthrough

Refs #346

Co-Authored-By: Claude Fable 5 <[email protected]>
@ryoppippi

Copy link
Copy Markdown
Member

oh yeah, coz i'm a maintainer, i can help it. ok let me check

@seandlg

seandlg commented Sep 2, 2026

Copy link
Copy Markdown

Hi! Just checking on the current status here. From what I can tell CI is green and the remaining discussion is around the packaging approach. Is there anything still blocking this, or anything I could help with?

Assisted-by: Claude Code (Claude Opus 4.8)
Build the global CLI from source and provide its JavaScript toolchain from
pinned npm dependencies, including upstream native bindings.

Use stable Cargo with vendoring fixups and stubbed fspy artifacts. Default
Node.js to system-first while preserving managed package-manager versions.
Provide the completed-installation marker and the vpr and vpx aliases so
first launch does not create another installation. Make copied project
templates writable outside the Nix store.

Assisted-by: Claude Code (Claude Opus 4.8)
Assisted-by: Codex (GPT-6)
@fengmk2 fengmk2 changed the title vite-plus: init at 0.2.1 vite-plus: init at 1.1.0 Oct 8, 2026
@nixpkgs-ci nixpkgs-ci Bot added the 7.no default reviewers This PR targets a package or module with no existing maintainers; roving reviewers, take pity! label Oct 8, 2026
@louwers

louwers commented Oct 11, 2026

Copy link
Copy Markdown

Tried this out.

Below is text written by Claude Opus 5.5...


checkPhase fails in the Linux build sandbox

Building vite-plus from this PR fails on x86_64-linux with the sandbox enabled. One test needs network access:

---- shim::dispatch::tests::test_resolve_with_cache_resolves_partial_env_version stdout ----

thread 'shim::dispatch::tests::test_resolve_with_cache_resolves_partial_env_version' (9282) panicked at crates/vp_global_cli/src/shim/dispatch.rs:1503:63:
called `Result::unwrap()` on an `Err` value: "Failed to download Node.js runtime: Failed to download from https://nodejs.org/dist/index.json: error sending request for url (https://nodejs.org/dist/index.json): client error (Connect): dns error: error resolving DNS: failed to lookup address information: Temporary failure in name resolution"

test result: FAILED. 406 passed; 1 failed; 0 ignored; 0 measured; 96 filtered out; finished in 5.62s

The test sets VP_NODE_VERSION=22 with an empty, temporary VP_HOME. To turn the partial version 22 into an exact one, resolve_with_cache has to fetch https://nodejs.org/dist/index.json. The sandbox has no network, so the request fails. I suspect it passed in your builds because they had network access. For example, the Nix sandbox is off by default on macOS.

Suggested fix: skip it alongside the other tests that fetch index.json:

     # Network: resolve version from nodejs.org/dist/index.json
     "--skip=commands::env::config::tests::"
     "--skip=commands::env::exec::tests::"
     "--skip=commands::env::pin::tests::"
+    "--skip=shim::dispatch::tests::test_resolve_with_cache_resolves_partial_env_version"

With this skip, the tests pass (406 passed; 0 failed; 97 filtered out), versionCheckHook passes, and vp --version runs.

Side note: the final compile runs on one core

Upstream's release profile sets lto = "fat" and codegen-units = 1, so rustc compiles and links the final vp crate on a single core. checkPhase runs cargo test --profile release, which repeats that single-core step for the test binary. On a 32-core machine, the test binary's final compile was still running on one core after 1m44s.

If build time matters more than the last bit of runtime performance, Cargo's environment overrides can change this without patching Cargo.toml. Because the package uses __structuredAttrs, they have to go under env:

env = {
  CARGO_PROFILE_RELEASE_LTO = "thin";
  CARGO_PROFILE_RELEASE_CODEGEN_UNITS = "16";
};

With these overrides, the vite-plus derivation built and passed its tests in 91 seconds, with the vendored crates and npm dependencies already in the store. The binary may be slightly less optimized than upstream's release build, so this is a trade-off rather than a fix.

Environment
  • PR head: a24a5642df261683b1e2dc9b55d66fcae6a0c848
  • Platform: x86_64-linux, Nix 2.34.8, sandbox = true
  • Built legacyPackages.x86_64-linux.vite-plus from the PR branch, unmodified, through a flake input

@fengmk2

fengmk2 commented Oct 16, 2026

Copy link
Copy Markdown
Author

@louwers Skipped the tests that depend on the network.

I did not change the compilation parameters, because they affect the final runtime performance. If compilation still feels too slow later on, we can look into whether to adjust them.

@ofborg ofborg Bot added the ofborg-internal-error Ofborg encountered an error label Oct 19, 2026
@merrkry

merrkry commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

I got a source build from upstream pnpm lockfile.

https://github.com/nix-community/nur-combined/blob/main/repos/merrkry/pkgs/vite-plus/default.nix#L292

Not sure if this is the correct approach, it compiles too many things...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

7.no default reviewers This PR targets a package or module with no existing maintainers; roving reviewers, take pity! 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 12.first-time contribution This PR is the author's first one; please be gentle! llm-assisted Contributions that include code generation with LLMs ofborg-internal-error Ofborg encountered an error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants