| ID | f0b56f89-559d-40d2-9b51-352377ca2b18 |
|---|---|
| DeertopiaVisibility | public |
Installing NixOS
Installing a hefty NixOS configuration to new hardware can come with a surprising obstacle: the usual flow, installing from a live system, usually won't work, as the tmpfs will run out of memory during installation. The easiest workaround is to build and install NixOS from a non-live system, particularly an existing NixOS machine.
Format & mount disks with Disko
IMPORTANT: Make sure the disk names used in disks.nix don't conflict with the host machine's. In such an event, Disko will use the hosts. Here, we pass the config an argument devices from the command line.
# Format «device» and mount to /mnt.
$ sudo nix --experimental-features "nix-command flakes" \
run github:nix-community/disko/latest -- \
--mode disko \
--arg devices '{«disk-name»="«device»";}' \
«path to disko config».nix
Building the system
On a NixOS host
# Build the system $ nixos-rebuild build --flake path:///persist/dots#«hostname» building the system configuration... Done. The new configuration is /nix/store/...
On a non-NixOS host
$ nix build .#nixosConfigurations.staging.config.system.build.toplevel
Installation
# ./result was generated in the previous step. $ sudo nixos-install --system ./result
This should be easy and quick, since Nix can copy closures from your existing Nix host.