Richard Bucker

Booting NixOS from USB

Posted at — Jan 10, 2015

Creating a bootable NixOS USB has been a challenge. I tried a number of different strategies and none of them worked. In the end the missing element was that the USB drive needed to be formatted as either FAT or FAT32; and the partition table needed to look traditional (my default USB partition table had an EFI partition; right or wrong it seems to have been part of the problem). Also there are a number of differences in ‘fdisk’ commands between OS' and that was frustrating too.These are not the steps but the discovery:I downloaded and created a SmartOS bootable USBCreating the USB device with the SmartOS image appeared to change the partition table in a way that reminded me of the old Windows and DOS days.Now I downloaded and installed NixOs for Virtualbox.I booted NixOS in Virtualboxin NixOSinstalled wget nix-env -i wgetinstalled unetbootin nix-env -i unetbootindownloaded the NixOS image with wgetinserted the USB device from above and allowed it to be recognized by NixOS (takes a couple of restarts and settings changes)executed unetbootin and used it to create the USBunmounted the USBunmounted the USBbooted my desktop with the USBWhat was amazing… (i) the target system was a UEFI BIOS and so I was hopeful but not expecting much as I had a lot of problems with booting from USB with older OS'. (ii) the touch screen worked out of the box even though button clicks still need to be resolved and that might have something to do with the fact that the USB mouse was also connected.NEXT STEPS: NixOS is the natural evolution from the Nix package manager. NixOS is a surprisingly clean operating system. What is truly amazing about it is so simple; the idempotence of the OS based on the package manager provides the same level of sensibility and pragmatism as CoreOS. I can see NixOS being part of a very similar strategy as CoreOS with it’s auto-updating channels even though that scheduling would be my responsibility.