My "flake"-less Nix configuration for NixOS, macOS, and WSL.
This project documents my journey through learning Nix(OS), and largely using NixOS as my sole development environment, via a VM, running aarch64 NixOS, on a macOS laptop (MacBook Pro).
Ideally, I'm trying to keep flakes1 out of this project. I will use third-party apps (e.g. disko) which may, themselves, use flakes, where applicable.
TBD
Expects to be run on a NixOS Minimal ISO Image.
Use either the Online Install or Local Install instructions.
-
Partitions the disk, then formats and mounts the partitions. Uses a similar process to the one outlined in NixOS Manual Installation.
-
Uses, or retrieves, from GitHub, this Custom Configuration.
-
Generates a basic configuration, which seems to be required for
nixos-install
. -
Installs, via
nixos-install
, from this Custom Configuration. -
Using the newly created
/etc/passwd
does the following:-
Prompts for user to own
/mnt/etc/nixos/config
directory. -
Asks if users' chezmoi dotfiles should be retrieved from GitHub.
This is a Work in Progress and currently pretty rudimentary.
- If yes, then loops though each user, asking to retrieve dotfiles for that user.
- If yes, then retrieves the dotfiles to
/home/<user>/dotfiles
from GitHub using the following URL:https://github.com/<user>/dotfiles.git
. - Asks if chezmoi install should be run at user's first login
-
If yes, then creates a script file and adds it to all login files for the user, i.e.
/home/<user>/.{bash_profile,login,profile,zprofile}
, to run chezmoi install file fromdotfiles
directory, i.e.sh "${HOME}/init-chezmoi.sh" && exec ${SHELL}
-
The script file
init-chezmoi.sh
does the following:- Run
${HOME}/dotfiles/install.sh
. - Removes the calls to
init-chezmoi.sh
from the login files, i.e./home/<user>/.{bash_profile,login,profile,zprofile}
. - Removes itself, i.e.
${HOME}/init-chezmoi.sh
.
- Run
-
- If yes, then retrieves the dotfiles to
- If yes, then loops though each user, asking to retrieve dotfiles for that user.
-
-
Asks if the system should reboot.
-
On the live Minimal ISO Image, run the following command:
sh <(curl -fsSL https://raw.githubusercontent.com/jwinn/nixos-config/main/install.sh)
-
On the live Minimal ISO Image, run the following to get the IP address:
ip route get 1.1.1.1 | grep -oP 'src \K[^ ]+'
-
On the live Minimal ISO Image, update the default nixos user to have a password.
passwd
-
Copy the Custom Configuration to the above IP, usually done through
scp
, e.g.scp -r nixos-config nixos@<ip_address>:~/
-
On the live Minimal ISO Image, run the install script.
cd nixos-config && sh install.sh cd -