This project contains clean, simple WSL2 builds that use Windows host native implementations of core components for maximum performance, convenience and flexibility.
- Combine components from different builds to tailor WSL environments for different purposes.
- Simple installations, often featuring quality of life configurations and helpers.
- Caching of large downloads on the Windows host, so you don't have to re-download install packages for rebuilds.
- Other build specific cache directories on the Windows host for convenience (eg: AI models and .pkl cache).
- Project motivation: WSL instances are disposable - streamlines a clean rebuild whenever its needed.
After provisioning a basic WSL instance, clone the project repo on it...
git clone https://github.com/SpoddyCoder/wsl-builds.git
Run the configure wizard to create a wsl-builds.conf from the template...
cd wsl-builds
./configure.sh
./wsl-builder.sh <build-dir> <component>[,<component>...] [additionalargs]... [--force]
build-dirany valid build directory name, see Build List. Each build has it's ownREADME.md.component[,<component>...]comma separated list of build components (packages to install etc.), varies per build.additionalargs...additional arguments required for some builds.--forceby default components that are already installed will be skipped with warning messages. Use this flag to force reinstallation of already-installed components.- The builder should be run as your current user, but some components will run commands that require escalated privileges using
sudo. - It is not designed to be used non-interactively, many installs require user input / confirmation.
./wsl-builder.sh # show all builds
./wsl-builder.sh dev-js # show components for build dev-js
# build a gen dev env
./wsl-builder.sh system update,qol,symlinks
./wsl-builder.sh dev essentials,vscode
./wsl-builder.sh dev-js node,yarn,nvm,essentials
change-hostname my-dev-box
# build a python environment for AI coding
./wsl-builder.sh system update,qol,symlinks
./wsl-builder.sh dev essentials,cursor
./wsl-builder.sh dev-python conda
./wsl-builder.sh ai cuda132
change-hostname python-ai- Each build is very simple, containing only a few related components intended to deliver a single purpose.
- Pick and choose! Use multiple runs of the build tool to combine components, packages, and features from different builds as you need.
- Build history is kept in
~/.wsl-build.info - Maintainers: optional advisory component reviews (no installs) are documented in review/README.md.
Saved build sequences live under stacks/<namespace>/ as .wslb files (one build-dir and comma-separated components per line; blank lines and # comments are ignored). ./wsl-stacker.sh runs the builder once per line:
./wsl-stacker.sh <namespace> <stack-name> [--force]
- With no arguments, or with a namespace only, it prints usage and available namespaces or stacks (same idea as listing builds or components with the builder).
- The first argument may be a stacks directory path instead of a repo
stacks/<namespace>shorthand. - Shipped examples: stacks/spoddycoder/README.md.
- Each line is a separate the builder run; apt index refresh is throttled across those runs in the same stack session (shared stamp and package-list freshness).
./wsl-stacker.sh spoddycoder dev| Build | Packages, Frameworks, Tools & Extras | Additional Conf |
|---|---|---|
| ai | cuda124: CUDA 12.4 cuda132: CUDA 13.2 ollama huggingface-cli: Hub hf CLI (pip)llama-cpp: build from source, optional CUDA cuda-wsl-lib-symlinks: fix 'not symlinks' issue |
ollama: OLLAMA_MODELShuggingface-cli: HF_HOME,HF_HUB_CACHE |
| ai-agents | setup-env: conda agents env,python-dotenv, httpx, jupyter, pydantic langchain: LangChain core langchain-ollama: Ollama integration langchain-llama-cpp: langchain-community + llama-cpp-python langgraph: LangGraph openai-agents: OpenAI Agents SDK langsmith: LangSmith Python SDK (LangSmith Cloud) langfuse: Langfuse Python SDK (Langfuse Cloud) mcp: Model Context Protocol Python SDK mcp-inspector: MCP Inspector (npm global) |
|
| ai-resources | sg3: stylegan3, pkl cache, pytorch cache lsd: lucid-sonic-dreams spleeter rudalle bfcl-eval: Gorilla BFCL benchmark |
sg3, lsd, spleeter, rudalle, bfcl-eval: AI_RESOURCES_PROJECT_DIRsg3: STYLEGAN3_PKL_CACHE,STYLEGAN3_PYTORCH_CACHEbfcl-eval: BFCL_PROJECT_ROOT |
| db | mysql-client mysql-server postgres-client postgres-server |
|
| dev | essentials: curl, wget, git, vim, nano, jq, yq vscode cursor: tree, code alias |
essentials: GIT_*,GIT_CREDENTIALS_HELPER |
| dev-bash | shellcheck bats |
|
| dev-js | node: Node.js, npm nvm yarn pnpm react: create-vite, react-devtools nextjs angular vue: create-vue express essentials: TypeScript, ESLint, Prettier, PM2, nodemon, serve |
|
| dev-python | python3 pipx uv conda: Anaconda |
|
| dev-ssg | hugo jekyll: Bundler, Ruby deps |
|
| media | ffmpeg: CLI encoder, transcoder ffmpeg-dev: ffmpeg CLI + libav dev libs, libx264-dev libprojectm: libprojectM from source, SDL UI |
libprojectm:LIBPROJECTM_SRC_DIR,LIBPROJECTM_INSTALL_PREFIX |
| devops | docker docker-desktop terraform packer kubectl k9s |
|
| devops-aws | awscli qol: aws-profile alias |
|
| security | harden-sandbox: DrvFs automount off, interop off, optional ~/ → /mnt symlink removal |
|
| system | update: apt update + upgrade essentials: htop, rsync x11: Windows native GUI smb: smbclient, cifs-utils nfs: nfs-common systemd wslu: wslview, wslsys qol: safety aliases, change-hostname, default user, WSL2 Distro Manager login → $HOMEsymlinks: host path → ~/… linksapt-mirror-switch: Canonical vs Uni of Kent apt mirror helper fstab: WSL mount config |
symlinks: SYMLINK_HOST_* |
- The builder loads
WSL_BUILDS_CONF(full path) if set, else~/.wsl-builds.conf. - On the Windows host, a shared file under
%USERPROFILE%\.wsl-builds\wsl-builds.confis useful if you want many WSL2 instances configured in the same way.- Choosing it in the configuration wizard saves
export WSL_BUILDS_CONF=…in your shell rc.
- Choosing it in the configuration wizard saves
- Otherwise the configuration wizard creates
~/.wsl-builds.confon the WSL instance - The
wsl-builds.conffile contains optional paths and settings- See the wsl-builds.conf.example for more info on what's available.
- Each build directory README will call out configurable values for that component.
- Tip: Caching things on the host can be uesful.
./configure.sh --noninteractiveif the default Windows hostwsl-builds.confalready exists it is adopted, otherwise the wizard uses the shipped default.
EXTERNAL_BUILDS_ROOTinwsl-builds.confcan point at anotherbuilds/directory outside the repo.- Each inner build directory must have
conf.sh,install.sh, andREADME.mdat its root; component install scripts live atbuilds/<build-dir>/<slug>/install.sh(CSV hyphens in the token map to underscores inslug, same as the builder dispatch). - See CONTRIBUTING.md for more info.
EXTERNAL_STACKS_ROOTinwsl-builds.confcan point at anotherstacks/directory outside the repo.
- Open PowerShell as an Administrator
wsl --install
- Install git on the Windows machine, ensure you select the option to use unix line endings.
- We are coding in linux, not Windows.
- To use the credentials from your Windows host on the WSL instance, see the wsl-builds.conf section.
- Install Cursor on the Windows machine, open it and launch it.
- Press CTRL + SHIFT + P to bring up the command palette
- Search for and run:
Shell Command: Install 'cursor' command - You can now type
cursoron the WSL instance to launch the current directory in a Cursor editor, running in Windows, with a remote connection to your WSL instance — sweet.
- Install VSCode on the Windows machine, select Additional Tasks, be sure to check the "Add to PATH" option.
- Now you can simply type
code .on the WSL instance to open the editor in windows. - The first time this command is run, it will install the package on the WSL instance.
- Install VSCode WSL extension
- Install an NVIDIA Windows driver with WSL CUDA support
- Use
./wsl-builder.sh ai cuda132to install the CUDA toolkit (orcuda124) on the WSL instance. Do not install Linux GPU drivers in WSL. - For more info: CUDA on WSL User Guide
- If you see
libcuda.so.1 is not a symbolic link, run the ai cuda-wsl-lib-symlinks component to fix it.
- Default memory is 50% of the Windows host memory: https://learn.microsoft.com/en-us/windows/wsl/wsl-config
- For AI work in particular you may find it useful to increase default memory, swap space and enable gradual memory reclaim, eg...
[wsl2]
memory=24GB
swap=16GB
networkingMode=mirrored # Bridge Windows and WSL2 networking (use this carefully)
[experimental]
autoMemoryReclaim=gradual
autoMemoryReclaim=dropcache # better for ai workloads
sparseVhd=true # reduces disk space usage with neglibible i/o overhead
Useful GUI for managing instances: https://github.com/bostrot/wsl2-distro-manager
wsl -l -v
wsl --list --online
wsl --install Ubuntu-22.04
wsl --export Ubuntu E:\WSL\builds\build-name
wsl --unregister Ubuntu-22.04
wsl --import my-project-name E:\WSL\instances\project-name D:\WSL\builds\build-name
wsl --shutdown
wsl --distribution my-project-name
- Shutdown the instance, export it to your build dir and kill it;
wsl --shutdownwsl --export Ubuntu-22.04 E:\WSL\builds\system-basewsl --unregister Ubuntu-22.04
- Your buttery biscuit base is ready to create new instances from :)
wsl --import my-new-project E:\WSL\instances\my-new-project E:\WSL\builds\biscuit