Install NixOS directly from a remote flake


This tutorial has not been completed yet.

Unlike the previous tutorials (1; 2), the goal here is to near-fully automate our NixOS install using one command (see the next section).

How to install

Boot your computer from any NixOS install live CD (Minimal ISO image is sufficient), and then from the terminal run:

Flake template?

Move this template to flake-parts/templates and guide users as to how to override it (to set system, hostname and root user’s authorized ssh key)?

# Assuming
# - your system is x86_64-linux
# - your harddrive device is /dev/sda
sudo nix \
    --extra-experimental-features 'flakes nix-command' \
    run github:nix-community/disko#disko-install -- \
    --flake "$FLAKE" \
    --write-efi-boot-entries \
    --disk main "$DISK_DEVICE"

Here, "github:nixos-asia/website?dir=global/nixos-install-oneclick#oneclick" is our own sample configuration flake. Feel free to substitute it with your own flake.

If everything goes well, you should see the installation successfully finish with a message like below:

Random seed file /boot/loader/random-seed successfully written (32 bytes).
Successfully initialized system token in EFI variable with 32 bytes.
Created EFI boot entry "Linux Boot Manager".
installation finished!
  • Take note of the IP address of your machine using ifconfig.
  • Reboot your computer (or VM)! Expect to boot into NixOS.
  • Test ssh access using ssh root@<ip-addr>

User management

The above flake is meant to be used on a server. As such, it authorizes root access through SSH keys.

  • If you are setting up a desktop, you may have to …

Making further changes to the flake

  • After install, how do we make further changes to the flake and apply that configuration? Can we simplify this?

This worked:

[root@oneclick:~]# git clone

[root@oneclick:~]# cd website/global/nixos-install-oneclick/

[root@oneclick:~/website/global/nixos-install-oneclick]# sudo nixos-rebuild switch --flake .
Links to this page