An environment to bootstrap building a nixos configuration for daily development of Ghaf and Nixos based projects.
This is a bootstrap setup and it is intended only as a starter kit. You will have to adjust this configuration as you become more familiar with nixos to best suit your needs.
- A linux machine to install Nixos on
- An ssd from which to install the image
- Download "NixOS : the Linux distribution"
- Burn the ISO to the ssd
- Insert the ssd
- lsblk to find the name of the ssd e.g.
/dev/sdb
sudo dd if=~/Downloads/NAME_OF_ISO.iso of=/dev/sdb bs=32M status=progress; sync
- Insert the ssd into the target machine
- Select the SSD boot from the BIOS of the target machine
- Enter the installer
- enable the wifi in the installer
- Follow the installation procedure in the installer
- enter location
- select the correct locale
- choose username/password
- use the same password for the Super User
- choose
Erase
when presented with the formatting option - Allow unfree packages
- Complete the installation
- choose reboot from the menu top right
- remove the ssd
- boot into the new Nixos Image
- Fork this repository to your own GitHub account
- Enable wifi on the target machine now that it has been installed
- Press the
windows key
- type
Console
and open the console application - Use the following command to install git temporarily
nix-shell -p git
git clone https://github.com/YOURNAME/nixos-bootstrap.git ~/.dotfiles
cd ~/.dotfiles
./pre-run.sh
- Enter all the details that are requested.
- Check that the process says "Success"
- Ensure the config is correct - type
YES
when prompted CAPITALYES
nixos-rebuild dry-run --flake .#YOUR_HOST_NAME
- Assuming that was successful - type
YES
when prompted CAPITALYES
sudo nixos-rebuild switch --flake .#YOUR_HOST_NAME
- Run the post script to finalize the installation
./post-build.sh
- Follow the instructions to add your ssh key to github
- reboot the laptop
- Open the terminal again and change back to your config.
cd ~/.dotfiles
- Add your keys to the ssh-agent
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/github-key
git remote remove origin
- In your nixos-bootstrap repo select
CODE
and choose the ssh option git remote add origin git@URL_OF_REPO
git fetch
git add --all
git commit -sm "Personalize Nixos Config"
git push origin main
- Create PRs to upload your builder-key.pub to the development repos.
- Find all TODO items and ensure that you follow the instructions to complete the setup.
There are some helper scripts that will enable you to use to keep this configuration upto date.
update-host
This will update the pinned version of the inputs in the flake.nix. In general it will fetch the latest versions of all the inputs and by doing this will update the flake.lock
file. This will mean that you have access to all the latest packages but it does not apply them to your system.
rebuild-host
This script will ensure that all the changes and updated packages are applied to your system. Every time that you add a package, change the configuration or run update-host
you should run rebuild-host
for those changes to take effect.
After you modify the configuration be sure to commit the changes to git and push the changes to your fork so that you have a reference in the case of disaster recovery.