This repository is intended to be a sane, batteries-included starter template for running a JeezyVim-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 24.05).
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.
- The default editor is JeezyVim
- win32yankis used to ensure perfect bi-directional copying and pasting to and from Windows GUI applications and LunarVim running in WSL
- The default shell is fish
- Native docker(ie. Linux, not Windows) is enabled by default
- The prompt is Starship
- fzf,- lsd,- zoxide, and- brootare integrated into- fishby default- These can all be disabled easily by setting enable = falsein home.nix, or just removing the lines all together
 
- These can all be disabled easily by setting 
- direnvis integrated into- fishby default
- gitconfig is generated in home.nix with options provided to enable private HTTPS clones with secret tokens
- fishconfig is generated in home.nix and includes git aliases, useful WSL aliases
There have been some recent changes in WSL2 that make running win32yank
within WSL2 very slow. You should install this on Windows by running scoop install win32yank or compiling it from source, and then adding it to your $PATH:
{
    programs.fish = {
      interactiveShellInit = ''
        fish_add_path --append /mnt/c/Users/<Your Windows Username>/scoop/apps/win32yank/0.1.1
      '';
    };
}- Get the latest release
- Install it (tweak the command to your desired paths):
wsl --import NixOS .\NixOS\ .\nixos-wsl.tar.gz --version 2- Enter the distro:
wsl -d NixOS- Get a copy of this repo (you'll probably want to fork it eventually):
git clone https://github.com/LGUG2Z/nixos-wsl-starter.git /tmp/configuration
cd /tmp/configuration- Change the username to your desired username in flake.nixwithnvim(or whichever editor you prefer)
- Install win32yankwithscoopand add it to your$PATHin NixOS
- Apply the configuration and shutdown the WSL2 VM
sudo nixos-rebuild switch --flake /tmp/configuration && sudo shutdown -h now- Reconnect to the WSL2 VM
wsl -d NixOS- cd ~and then- pwdshould now show- /home/<YOUR_USERNAME>
- Move the configuration to your new home directory
mv /tmp/configuration ~/configuration- Go through all the FIXME:notices in~/configurationand make changes wherever you want
- Apply the configuration
sudo nixos-rebuild switch --flake ~/configurationNote: 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.nixis where dependencies are specified- nixpkgsis the current release of NixOS
- nixpkgs-unstableis the current trunk branch of NixOS (ie. all the latest packages)
- home-manageris used to manage everything related to your home directory (dotfiles etc.)
- nuris the community-maintained Nix User Repositories for packages that may not be available in the NixOS repository
- nixos-wslexposes important WSL-specific configuration options
- nix-index-databasetells you how to install a package when you run a command which requires a binary not in the- $PATH
 
- wsl.nixis where the VM is configured- The hostname is set here
- The default shell is set here
- User groups are set here
- WSL configuration options are set here
- NixOS options are set here
 
- home.nixis where packages, dotfiles, terminal tools, environment variables and aliases are configured
