This repository is intended to be a sane, batteries-included starter template for running a LunarVim-powered NixOS development environment on WSL.
If you don't want to dig into NixOS too much right now, the only file you need
to concern yourself with is home.nix. This is where you can add and
remove binaries to your global $PATH
.
Go to https://search.nixos.org to find the correct package names, though usually they will be what you expect them to be in other package managers.
unstable-packages
is for packages that you want to always keep at the latest
released versions, and stable-packages
is for packages that you want to track
with the current release of NixOS (currently 23.11).
If you want to update the versions of the available unstable-packages
, run
nix flake update
to pull the latest version of the Nixpkgs repository and
then apply the changes.
Make sure to look at all the FIXME
notices in the various files which are
intended to direct you to places where you may want to make configuration
tweaks.
If you found this starter template useful, please consider sponsoring and subscribing to my YouTube channel.
This starter is a lightly-opinionated take on a productive terminal-driven development environment based on my own preferences. However, it is trivial to customize to your liking both by removing and adding tools that you prefer.
lvim
win32yank
is used to ensure perfect bi-directional copying and pasting tozsh
docker
(ie. Linux, not Windows) is enabled by defaultfzf
,lsd
,zoxide
, andbroot
are integrated into zsh
byenable = false
indirenv
is integrated into zsh
bygit
config is generated in home.nix with options provided tozsh
config is generated in home.nix and includes git aliases,$WORDCHARS
wsl --import NixOS .\NixOS\ .\nixos-wsl.tar.gz --version 2
wsl -d NixOS
sudo nix-channel --add https://nixos.org/channels/nixos-23.11 nixos
sudo nix-channel --update
nix-shell -p git neovim
git clone https://github.com/LGUG2Z/nixos-wsl-starter.git /tmp/configuration
cd /tmp/configuration
flake.nix
with nvim
(or whichever editor you prefer)sudo nixos-rebuild switch --flake /tmp/configuration
wsl -t NixOS
wsl -d NixOS
cd ~
and then pwd
should now show /home/<YOUR_USERNAME>
mv /tmp/configuration ~/configuration
FIXME:
notices in ~/configuration
and make changessudo nixos-rebuild switch --flake ~/configuration
Note: If developing in Rust, you'll still be managing your toolchains and components like rust-analyzer
with rustup
!
In order to keep the template as approachable as possible for new NixOS users, this project uses a flat layout without any nesting or modularization.
flake.nix
is where dependencies are specified
nixpkgs
is the current release of NixOSnixpkgs-unstable
is the current trunk branch of NixOS (ie. all thehome-manager
is used to manage everything related to your homenur
is the community-maintained Nix Usernixos-wsl
exposes important WSL-specific configuration optionsnix-index-database
tells you how to install a package when you run a$PATH
wsl.nix
is where the VM is configured
home.nix
is where packages, dotfiles, terminal tools, environment variablessudo nixos-rebuild switch systemctl --user enable auto-fix-vscode-server.service
systemctl --user start auto-fix-vscode-server.service