Creating NixOS Install Media
- Download NixOS from https://nixos.org/download/#nixos-iso
- Historically I use the latest NixOS Minimal ISO
- Write the ISO Image to a USB Drive
sudo dd bs=4M conv=fsync oflag=direct status=progress if=<path-to-image> of=/dev/sdX
Installing NixOS
- Boot into NixOS install media
- Ensure you have an internet connection
- Wireless as of NixOS 26.05 can be setup using
nmtui
- Wireless as of NixOS 26.05 can be setup using
- Clone this repo.
git clone https://git.hjaalmarch.dev/kruziikrel13/nixos.git - Partition the disk using provided script.
sudo ./partition-disktargetDrive - If installing on a totally new machine see Installing on New Machines otherwise skip to step 6.
- Install the flake using provided script
sudo ./install-flakehostName- Alternatively NixOS can be built from an existing NixOS install and then copied over using
nh
- Alternatively NixOS can be built from an existing NixOS install and then copied over using
Distributed Build Install
With nh installed. A NixOS configuration can be built for another host using nh os build --target-host
Disk Encryption
Placeholder
New Machines
Totally new machines need, at minimum a viable hardware configuration. To generate this, partitioning and encryption should be already completed.
Instead of running the install script a basic machine config should first be generated.
nixos-generate-config --show-hardware-config --root /mnt > hardware-configuration.nix
Once generated, translate the hardware configuration across to your new host file. For structure and format of a host file, refer to existing configurations.
Once the new host file (with at least the hardware config) has been created. Proceed to step 6 of Installing NixOS
Dual Booting with Windows
For more granular control of the BOOT partition, such as it's size and filesystem. NixOS should generally be installed first, and the boot partition created during the install process.
NixOS -> Windows
If re-installing Windows over an existing NixOS install. Windows will obliterate Linux's systemd boot loader. The boot loader can be re-installed through a NixOS install media.
- Boot into NixOS install media
- Mount linux root drive along with boot.
- Run
sudo install-flakehostName
Windows should be automatically detected and re-added to the Systemd Boot list.
In case of Boot Entry Removal
When updating BIOS, in most dual boot environments, the Linux boot entry will get removed and the BIOS secure boot database gets reset. This makes Linux inaccessible temporarily.
- Disable Secure Boot in the BIOS
- Boot into NixOS Install Media
- Mount root partition and boot partitions.
- Run
sudo nixos-enterto enter original NixOS Configuration - Re-install the boot entry with
bootctl install - Assuming the Linux boot entry is now back in the BIOS List. Reboot back into the BIOS and re-enable Secure Boot and turn on Setup Mode.
- Ensure that the BIOS does not automatically provision factory keys even in Setup Mode otherwise the Linux boot entry will be disallowed from booting.
- Allow Lanzaboote to auto-enrol the keys again.
- Alternatively, boot back into working system and run
sudo sbctl enroll-keys --microsoft
- Alternatively, boot back into working system and run
The Linux boot entry should now be re-added and secure boot should also be re-enabled at this point.
© 2025 - 2026 Michael Petersen. All rights reserved.