Installation Guide
This guide will walk you through installing NixOS using the provided installation script install.sh
.
Prerequisites
- Bootable NixOS Installation Medium: Make sure you have booted into NixOS live environment from the Minimal ISO image. Read the official NixOS installation guide for more information on how to create a bootable NixOS USB drive.
- Network Connection: Ensure the target machine is connected to the internet.
- Host configuration: The target machine needs to have a working NixOS configuration inside your own flake. A hardware configuration is not required as it can be generated automatically during installation.
- Disks setup: The target machine needs to have a working disk configuration or partitioning script inside
hosts/HOSTNAME
. Disko expects its configuration to be inhosts/HOSTNAME/disks.nix
. Alternatively, a shell script can be provided athosts/HOSTNAME/disks.sh
that will format, partition, and mount disks.
Using UEFI is recommended.
Optional: Virt-Manager config for Wayland
If you want to install NixOS with Wayland support inside a VM using Virt-Manager, enable 3D acceleration by checking Customize configuration before install
:
- Go to
Display <VNC or Spice>
and selectSpice Server
underType
. SelectNone
underListen type
. CheckOpenGL
and select a device that is not from Nvidia. - Go to
Video <some name>
and selectVirtio
underModel
. Check3D acceleration
. - Click
Begin installation
in the top left corner.
If you get the error:
Unable to complete install: 'unsupported configuration: domain configuration does not support video model 'virtio''
Install the package qemu-full
:
assuming you are on Arch Linux
Then, reboot.
Steps
Boot into NixOS ISO image on your target machine.
0. SSH into the Target Machine
If you are using a remote machine, set a password for the user nixos using passwd
. Then, SSH into it using the following command:
Replace
<host-ip-address>
with the IP address of the target machine which can be found usingip a
.
1. Become root
The default user nixos
has sudo privileges. Become root to run the install script:
2. Run the Install Script
Download the install script to the target machine and run it:
nix --experimental-features "nix-command flakes" run github:sid115/nix-core#apps.x86_64-linux.install -- \
-n HOST \
-r REPOSITORY
Replace
HOST
with the name of your target machine.
ReplaceREPOSITORY
with your flake URL.
You can specify a branch with-b BRANCH
(default:master
)
Print the usage page with-h
.
Change the architecture if needed.
3. Reboot your System
Once the installation completes, unmount the installation medium:
If you have your root file system on ZFS, export all pools:
zpool export -a
Then, you can safely remove the installation medium and reboot your machine:
If you generated a new hardware configuration, you should save it before rebooting:
cat /tmp/nixos/hosts/HOSTNAME/hardware.nix
4. Login
Upon reboot, your system will boot into the newly installed NixOS. Login as a valid user defined in the configuration of the host (hosts/HOSTNAME/default.nix
). The default initial password is changeme
. Change your password with passwd
after login.
5. Optional: Import age keys
If you use sops-nix with age in you Home Manager configuration, you need to import your age keys:
6. Clone your Repository
Git is installed on every system by default. Clone your flake repository to your home directory:
The rebuild script expects your flake to be in
~/.config/nixos
7. Apply your Home Manager Configuration
Home Manager is not installed by default. Enter the development shell to apply the configuration:
8. Reboot your System
Once the home-manager configuration is applied, reboot your system:
You may now log in. Your system is now fully configured.