2. Quick Installation
`The ability to quickly and easily install your configuration is important for many reasons. To accomplish this, we want to be able to copy the configuration, remove unnecessary files, and create additional data with as few steps as possible.
The easiest approach is to store your config on a public GitHub repository. This allows us to clone your config without logging into any account. You can also include any commands necessary for installation inside the README. If you don’t want to use GitHub, there are many other ways to accomplish this.
First, we need to ensure that we are using the correct shell. Another requirement is specifying the hostname. If your architecture is similar to mine, your rebuild commands read the hostname from a file.
Snippet from my installation process:
bashexport host=<desktop/laptop/server>Next, we need to clean any unnecessary files inside /etc/nixos/. This can be
done simply with:
sudo rm -rf /etc/nixosmkdir /etc/nixos/Then, if needed, we can add the $host data to the /etc/nixos/host.txt file.
I also create an onUpdate.sh file, which is used to run various tasks when
updating the system.
Next, clone the repository that contains your configuration. For me, this is:
sudo git clone https://github.com/FilipRuman/NNC.git
Finally, switch to the new config using:
sudo nixos-rebuild switch --upgrade --flake ".#$host"
Snippet from my installation process:
sudo rm -rf /etc/nixosmkdir /etc/nixos/cd /etc/nixos || exitsudo echo "$host" >./host.txt# On update filetouch onUpdate.shsudo chmod +x onUpdate.shsudo git clone https://github.com/FilipRuman/NNC.gitcd ./NNC/ || exitsudo nixos-rebuild switch --upgrade --flake ".#$host"If you find anything to improve in this project’s code, please create an issue describing it on the GitHub repository for this project. For website-related issues, create an issue here.
Support
Section titled “Support”All pages on this site are written by a human, and you can access everything for free without ads. If you find this work valuable, please give a star to the GitHub repository for this project.