We strongly recommend enabling systemd, then installing Nix as normal.
This is now enabled by default on Ubuntu 24.04 LTS.
To check, use:
cat /etc/wsl.conf
[boot]
systemd=true
First make sure, your user is in the sudo/wheel group.
# Install git, curl and xz (e.g. for ubuntu)
sudo apt install git xz-utils curl
# Clone this repository
git clone https://github.com/iancleary/nixos-config.git
cd nixos-config
# Install nix (determinate-systems installation)
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
# Open tempoary shell with nix and home-manager (shell.nix)
# if no flake.lock exists, run `nix flake update`
# if 755 permission error, restart windows
nix-shell
# Remove nix (this is necessary, so home-manager can install nix)
nix-env -e nix
# Install the configuration (adjust to the configuration/hostname you want to use )
home-manager switch --flake .#windows-tower
home-manager switch --flake .#framework
# Exit temporary shell
exit
# Set zsh (installed by nix) as default shell
echo ~/.nix-profile/bin/zsh | sudo tee -a /etc/shells
sudo usermod -s ~/.nix-profile/bin/zsh $USER
# for rustup (from nix flake iancleary/terminal-config)
sudo apt install build-essential
Test in another terminal tab before closing first one!
To revert, or reinstall if you have issues, use this to uninstall, then repeat the installation from the top
sudo nano /etc/shells
# remove ~/.nix-profile/bin/zsh
sudo usermod -s /usr/bin/bash $USER
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- uninstall
# Go to the repo directory
home-manager switch --flake .