This repository contains various scripts and configurations for setting up a unified Dirac NixOS environment.
There is support for both baremetal installations of NixOS installation in WSL2.
Navigate to the engineering folder on the Dirac Google Drive.
Download the dirac-nixos.wsl
file to your local machine. Navigate to the file in file explorer. Then, right click in the folder and select "Open in Terminal".
wsl --install
wsl --list --verbose
Ensure this shows WSL version 2. Run the following command to install the tarball:
wsl --install --from-file .\dirac-nixos.wsl --name DiracNixOS
To launch the environment, run:
wsl -d DiracNixOS
To set this as the default WSL distribution, run:
wsl --setdefault DiracNixOS
If attempting this, contact @drew-dirac for assistance. More complicated, but it will be worth it!
First, install NixOS using the graphical installation ISO. https://channels.nixos.org/nixos-24.11/latest-nixos-gnome-x86_64-linux.iso
After downloading the ISO, burn it to a USB drive using a tool like Etcher and install NixOS.
- Back up all important data before proceeding with installation
- If dual booting with Windows, ensure you have:
- Disabled Fast Startup in Windows
- Disabled Secure Boot in BIOS
- Created unallocated disk space for NixOS
- Expanded the EFI boot partition: see this wiki page
- Generally, dual booting is not recommended. Lots of ways to break the Windows installation.
- The installation will format the target drive/partition, permanently erasing its contents
- If you're unsure about any steps, consult the NixOS Manual or seek assistance (@drew-dirac)
Once you have booted into the live environment, follow the graphical installer prompts to install NixOS.
After installation is complete, run the following:
nix --extra-experimental-features "nix-command flakes" run github:diracq/nix-envs
This will clone the nix-envs repository to /etc/nixos/nix-envs and modify /etc/nixos/configuration.nix to import the nix-envs modules.
First, update your system configuration and apply it:
sudo git -C /etc/nixos/nix-envs pull
sudo nixos-rebuild switch --upgrade
Then, run the following to configure github and our monorepo. Be sure to select SSH as the authentication method.
mkdir dirac && cd dirac
gh auth login
gh repo clone diracq/buildos-web -- --recurse-submodules && cd buildos-web
# you may need to explicitly allow the direnv hook
cd buildos-web && direnv allow
You should see a message that states nix environment initialized
.
You are now done setting up your NixOS environment! Continue to follow the instructions in the buildos-web README to get the repo configured.
To update NixOS and rebuild based on your /env/nixos/configuration.nix
file, run the following:
sudo nixos-rebuild switch --upgrade
You can omit --upgrade
if you just want to evaluate the system configuration and not update packages.
Your ~/.zshrc
is in the normal place and can be tweaked as you like it.
To install or modify packages, edit the /etc/nixos/configuration.nix
file. Guide for the reccomended method
⚠️ Warning: Avoid all use of thenix-env
command. It is not declarative. It is much nicer to just add packages to theenvironment.systemPackages
list.
To build the configuration, run sudo nixos-rebuild switch
.
Below are the steps to build and set up a WSL2 tarball manually (in case the preconfigured tarball is not available/functional).
On a machine with Nix installed (and flakes/nix-command enabled), run the following command to build the tarball:
sudo nix run github:diracq/nix-envs#nixosConfigurations.wsl.config.system.build.tarballBuilder
We build from this repository's flake, as we set the nixpkgs channel to a newer stable version than nix-wsl's default.
This will output a nixos.wsl file in the current directory.
wsl --install --from-file nixos.wsl --name DiracNixOS
sudo nix --extra-experimental-features "nix-command flakes" run github:diracq/nix-envs
This will clone the nix-envs repository to /etc/nixos/nix-envs and modify /etc/nixos/configuration.nix to import the nix-envs modules.
wsl --export DiracNixOS .\dirac-nixos.wsl