A VS Code extension that provides Nix flake management for development containers. This extension automatically creates shell scripts from the output of nix print-dev-env
for each devshell, making Nix development environments seamlessly available in your devcontainer.
- Automatically find Nix flakes in workspace folders
- Create shell scripts from
nix print-dev-env
output for each devshell - Generate environment scripts in
/etc/profile.d/
for automatic loading - Update Nix development shell profiles
- Reload window after profile updates
- Support for multiple flakes in a workspace
Nix DevContainer: Find Flakes
- Discovers all flake.nix files in workspace foldersNix DevContainer: Update Single Flake
- Update a specific flake by nameNix DevContainer: Update All Flakes
- Update all discovered flakesNix DevContainer: Find and Update All Flakes
- Find and update all flakes in one command
The extension scans workspace folders for flake.nix
files and creates shell scripts from the output of nix print-dev-env
for each devshell. These scripts are saved in /etc/profile.d/nix-devcontainer-{flake-name}.sh
to provide the development environment automatically when opening a terminal. When a flake is updated, you'll be prompted to reload the window to apply the changes.
This extension is designed to be used with the Nix DevContainer feature. Add this to your devcontainer.json
:
{
"features": {
"ghcr.io/akospapp/devcontainer-features/nix-devcontainer:latest": {}
}
}
- VS Code Extension: https://github.com/AkosPapp/nix-devcontainer.vscode
- DevContainer Feature: https://github.com/AkosPapp/devcontainer-features/tree/main/src/nix-devcontainer
- Nix package manager installed (automatically provided by the devcontainer feature)
- Running in a container or environment with sudo access to
/etc/profile.d/
- VS Code with workspace folders containing
flake.nix
files with devShells.
- Add the devcontainer feature to your
devcontainer.json
- Open your workspace in a devcontainer
- The extension will automatically activate and process all flakes
- Reload the window when prompted to apply environment changes
- Open a workspace containing Nix flakes
- Use
Ctrl+Shift+P
to open the command palette - Run
Nix DevContainer: Find and Update All Flakes
to get started - Reload the window when prompted to apply environment changes
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Watch for changes during development
npm run watch
# Lint the code
npm run lint
# Package the extension
npm run package
- Open this folder in VS Code
- Press
F5
to run the extension in a new Extension Development Host window - Open the Command Palette (
Ctrl+Shift+P
) and try the Nix DevContainer commands
After packaging, you can install the extension using:
npm run install-extension
Or manually install the generated .vsix
file through VS Code.