Flox: Your dev environment, everywhere.
Flox is a virtual environment and package manager all in one. With Flox you create environments that layer and replace dependencies just where it matters, making them portable across the full software lifecycle.
flox-vscode is a VSCode extension that integrates Flox environments with Visual Studio Code, providing a seamless UI for managing packages, environment variables, and services.
π Remote Development - Works with Remote SSH, Dev Containers, and WSL π€ AI Integration - MCP server for GitHub Copilot and AI assistants β¨ Sidebar UI - Manage your Flox environment directly from VSCode's sidebar π¦ Package Management - Install, upgrade, and remove packages with one click π§ Environment Variables - View and manage environment variables π Services - Monitor and control background services π Auto-sync - Automatic refresh when manifest files change π» Integrated Terminal - Environment variables automatically applied to terminals π Auto-Activation - Prompts to activate environment with remember preference π Pending Indicators - Visual markers for uncommitted manifest changes π Auto-Reactivate - Environment refreshes when manifest.toml changes π Service Logs - View real-time logs for running services π Debug Output - Detailed logs in the Output panel for troubleshooting β Update Checks - Notifies when newer Flox versions are available π¨ Status Bar - Shows active environment with custom Flox icon π TOML Support - Syntax highlighting and validation for manifest.toml
- Flox: Install from flox.dev/docs/install-flox
- VSCode: Version 1.87.0 or higher
Note: If Flox is not installed, the extension will display a message with a link to the installation guide.
- Open VSCode
- Go to Extensions (Cmd+Shift+X / Ctrl+Shift+X)
- Search for "Flox"
- Click "Install"
code --install-extension flox-vscode-*.vsix# Navigate to your project directory
cd my-project
# Initialize a new Flox environment
flox init
# Install some packages
flox install nodejs python3 git
# Activate in VSCode
# Open Command Palette (Cmd+Shift+P / Ctrl+Shift+P)
# Run: "Flox: Activate"Activating an Environment:
- Open a project with a Flox environment (
.flox/directory) - Open Command Palette (Cmd+Shift+P / Ctrl+Shift+P)
- Run
Flox: Activate - Environment activates in background and terminals get environment variables
Installing Packages:
- Open the Flox sidebar view
- Click the "+" icon in the Packages section
- Enter the package name (e.g.,
nodejs,python3) - Package will be installed and available immediately
Viewing Environment Variables:
- Open the Flox sidebar
- Expand the "Variables" section
- All environment variables from your manifest are listed
Managing Services:
- View service status in the "Services" section
- Start/stop services with the play/stop buttons
- Check service logs in the Output panel
Access these via Command Palette (Cmd+Shift+P / Ctrl+Shift+P):
Flox: Init- Create a new Flox environment in current workspaceFlox: Activate- Activate the Flox environmentFlox: Deactivate- Deactivate the current environmentFlox: Install- Install a packageFlox: Uninstall- Remove a packageFlox: Upgrade- Upgrade a package to latest versionFlox: Edit- Open manifest in editorFlox: Search- Search for packages in Flox catalogFlox: Show service logs- Open terminal with live service logsFlox: Configure Flox MCP Server- Set up MCP for CopilotFlox: Install Flox- Open installation page (shown when Flox not installed)Flox: Upgrade Flox- Open upgrade instructions (shown when update available)
Configure the extension behavior via VSCode settings:
| Setting | Default | Description |
|---|---|---|
flox.promptToActivate |
true |
Show popup when Flox environment is detected |
flox.checkForUpdates |
true |
Check for Flox CLI updates (once per 24 hours) |
Per-Workspace Behavior:
- After activation prompt, choose "Always Activate" or "Never Activate" to remember preference
- Preference is stored per-workspace in VSCode's workspace state
The extension integrates with GitHub Copilot via the Model Context Protocol (MCP) to provide AI-powered Flox tools.
- VSCode 1.102 or higher
- GitHub Copilot extension installed
flox-mcpcommand available in PATH (from Flox Agentic)
- Activate your Flox environment
- If
flox-mcpis detected, a notification will appear - Click "Configure MCP" to enable the integration
- Or run Command Palette β "Flox: Configure Flox MCP Server"
- Flox-specific tools available in Copilot Chat agent mode
- Context-aware package suggestions
- Environment management through natural language
The extension uses a background process for activation (no VSCode restart required!). This enables:
- Remote SSH - Works with remote servers
- Dev Containers - Works inside containers
- WSL - Works with Windows Subsystem for Linux
The extension:
- Spawns a background
flox activateprocess - Captures all environment variables via IPC
- Applies them to VSCode's integrated terminal
- Ensures tools like Node.js, Python, etc. are available to other extensions
The extension looks for a .flox/ directory in your workspace root. When detected:
- Sidebar view becomes available
- Commands are enabled
- File watchers monitor
manifest.tomlandmanifest.lockfor changes
Flox environments are isolated - your system packages remain unchanged. When you activate a Flox environment:
- Flox packages take precedence in
$PATH - System packages are still accessible as fallback
- Deactivating restores your original environment
Currently, the extension supports one environment per workspace. For multiple environments:
- Use VSCode multi-root workspaces
- Layer environments at runtime (see Flox layering docs)
- Switch between projects with different environments
Flox environments are fully reproducible:
# Commit the Flox manifest
git add .flox/env/manifest.toml .flox/env/manifest.lock
git commit -m "Add Flox environment"
git push
# Team members can activate immediately
git clone <your-repo>
cd <your-repo>
flox activate- VSCode: Use
Flox: Searchcommand - CLI:
flox search <package-name> - Web: Browse at flox.dev
Flox has millions of package versions from the Nix ecosystem!
- Open the Output panel (View β Output)
- Select "Flox" from the dropdown
- Logs show command execution, file changes, and activation lifecycle
Global: Set flox.promptToActivate to false in settings
Per-Workspace: Click "Never Activate" when prompted - this workspace won't prompt again
Set flox.checkForUpdates to false in settings to skip periodic Flox version checks.
Items with * are "pending" - they exist in manifest.toml but haven't been committed to the lock file yet. Run flox activate to apply changes.
Want to contribute or modify the extension? Here's how to get started!
- Flox: Install from flox.dev
- VSCode: Version 1.87.0 or higher
- Git: For cloning the repository
# 1. Clone the repository
git clone https://github.com/flox/flox-vscode.git
cd flox-vscode
# 2. Activate the Flox development environment
# This provides Node.js, npm, TypeScript, and all build tools
flox activate
# 3. Install npm dependencies
npm install
# 4. Compile TypeScript
npm run compile# Start watch mode (auto-recompile on changes)
npm run watch
# In VSCode, press F5 to launch Extension Development Host
# Or use "Run > Start Debugging"The Extension Development Host window opens with your development version loaded. Make changes to the code, and reload the window (Cmd+R / Ctrl+R) to see updates.
# Run all tests (lint + unit tests)
npm test
# Run only linting
npm run lint
# Run only unit tests
npm run test:unitflox-vscode/
βββ .flox/ # Flox development environment
βββ src/
β βββ extension.ts # Extension entry point
β βββ env.ts # Core Flox integration
β βββ view.ts # TreeView providers (sidebar UI)
β βββ config.ts # Type definitions
β βββ test/ # Tests
βββ scripts/
β βββ activate.sh # Background activation script
βββ package.json # Extension manifest
βββ tsconfig.json # TypeScript config
# Compile TypeScript
npm run compile
# Watch mode (auto-compile)
npm run watch
# Clean build artifacts
npm run clean
# Run tests
npm test
# Package extension as .vsix
npm run package
# Install packaged extension
code --install-extension flox-vscode-*.vsix- Open the project in VSCode
- Activate Flox environment:
flox activate - Press F5 to launch Extension Development Host
- Set breakpoints in TypeScript source files
- Use Debug Console to inspect variables
- Check Output panel for extension logs
Adding a New Command:
- Register in
src/extension.ts:env.registerCommand('flox.myCommand', handler) - Implement handler in
src/env.ts - Add to
package.jsonundercontributes.commands - Test in Extension Development Host
Modifying the Sidebar:
- Edit view classes in
src/view.ts - Update
getChildren()for new items - Update
getTreeItem()for rendering - Refresh with
_onDidChangeTreeData.fire()
Understanding Flox Integration:
src/env.ts- All Flox CLI interactionsscripts/activate.sh- Background process that captures env vars- File watchers monitor
manifest.tomlandmanifest.lockfor changes - Environment variables applied to VSCode terminals via
environmentVariableCollection
# 1. Compile your changes
npm run compile
# 2. Run tests
npm test
# 3. Launch Extension Development Host (F5)
# 4. Test functionality manually
# 5. Package and test the .vsix
npm run package
code --install-extension flox-vscode-*.vsixExtension won't load:
- Check for TypeScript errors:
npm run compile - Verify package.json syntax
- Check Output panel for error messages
Changes not reflected:
- Ensure watch mode is running:
npm run watch - Reload Extension Development Host (Cmd+R / Ctrl+R)
- Check TypeScript compiled successfully
Flox environment issues:
- Verify activation:
flox listshould show packages - Check manifest:
flox list -c - Reinstall dependencies:
npm install
Why Flox?
- Reproducible development environment
- Same Node.js and npm versions for all contributors
- No conflicts with system packages
- Cross-platform (macOS, Linux)
Modifying the Development Environment:
# Add a development tool
flox install <package>
# View installed packages
flox list
# Edit manifest
flox editRunning Commands Without Activating:
# Useful for CI/CD
flox activate -- npm test
flox activate -- npm run compile- CLAUDE.md - Comprehensive development guide for Claude Code users
- Architecture - See CLAUDE.md for detailed architecture documentation
- VSCode Extension API - https://code.visualstudio.com/api
- Flox Docs - https://flox.dev/docs
We welcome contributions to this project! Here's how:
- Fork the repository
- Clone your fork:
git clone https://github.com/your-username/flox-vscode.git - Create a branch:
git checkout -b feature/my-feature - Activate Flox:
flox activate - Make changes and test thoroughly
- Run tests:
npm test - Commit:
git commit -m "feat: add feature" - Push:
git push origin feature/my-feature - Open a Pull Request
Please read the Contributor guide for detailed guidelines.
- Follow existing code style (TypeScript strict mode)
- Add tests for new features
- Update documentation (README, CLAUDE.md)
- Ensure all tests pass:
npm test - Keep PRs focused on a single feature/fix
- π Flox Documentation - Learn about Flox
- π Get Support - Join Slack community
- π¬ Discourse Forum - Ask questions
- π Report Issues - File bugs or feature requests
- π VSCode Extension API - Extension development guide
The Flox VSCode Extension is licensed under the GPLv2. See LICENSE.
