cloudflare/vinext

Public

mirrored fromhttps://github.com/cloudflare/vinextAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
23f9e1e13decb3ee024adc6a091b9252427f8e2e

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

nix/devShell.nix

68lines · modecode

1{
2 mkShell,
3 nodejs_24,
4 oxlint,
5 gh,
6 jq,
7 nixfmt,
8}:
9mkShell {
10 name = "vinext";
11
12 packages =
13 [
14 # Runtime — Node.js 24 ships with corepack, which reads the
15 # packageManager field from package.json to install the exact
16 # pnpm version the project declares (e.g. pnpm@10.30.0).
17 nodejs_24
18
19 # Linting (matches pnpm run lint)
20 oxlint
21
22 # Nix formatting
23 nixfmt
24
25 # Utilities
26 gh # GitHub CLI — used in AGENTS.md workflow (gh search code)
27 jq
28 ];
29
30 env = {
31 # Allow corepack to download the pnpm version specified in packageManager
32 # without an interactive confirmation prompt (which hangs in non-TTY shells).
33 COREPACK_ENABLE_DOWNLOAD_PROMPT = "0";
34
35 # Playwright browser downloads are left at their default (enabled).
36 # We intentionally do NOT use Nix-provided playwright-driver.browsers
37 # because its version would couple to nixpkgs and likely mismatch the
38 # @playwright/test version in package.json, causing runtime failures.
39 #
40 # Note: on NixOS or in --pure Nix shells, Playwright also needs system
41 # libraries (GTK3, ALSA, libdrm, etc.) that are not provided here.
42 # E2E tests work on standard Linux/macOS where these libraries are
43 # available from the host. For NixOS, you may need to wrap the Playwright
44 # binary with the required library paths or use a FHS environment.
45 };
46
47 shellHook = ''
48 # Corepack is bundled with Node.js but needs a writable directory for
49 # its shims since the Nix store is read-only. We create a local bin
50 # directory and prepend it to PATH.
51 COREPACK_INSTALL_DIR="$PWD/.corepack/bin"
52 mkdir -p "$COREPACK_INSTALL_DIR"
53 export PATH="$COREPACK_INSTALL_DIR:$PATH"
54 corepack enable --install-directory "$COREPACK_INSTALL_DIR" 2>/dev/null
55
56 echo "🚀 vinext dev shell"
57 echo " Node.js $(node --version)"
58 echo " pnpm $(pnpm --version 2>/dev/null || echo '(downloading...)')"
59 echo ""
60
61 # Install dependencies if node_modules is missing or lockfile has changed.
62 # pnpm uses .modules.yaml (not npm's .package-lock.json).
63 if [ ! -d node_modules ] || { [ -f pnpm-lock.yaml ] && [ pnpm-lock.yaml -nt node_modules/.modules.yaml ]; }; then
64 echo "📦 Running pnpm install..."
65 pnpm install --frozen-lockfile || echo "⚠️ pnpm install failed. Run it manually to see the full error."
66 fi
67 '';
68}
69