Installing NixOS on the Intel NUC

4 minute read Published: 2022-03-01

I recently got a NUC 11 kit, got a Samsung SSD and quite a bit of RAM, wanted to follow the official guide to installing NixOS 21.11 from a USB flash drive, but I ran into a few snags, especially when doing the partitioning of the drive.

Booting

The NUC (at least version 11,) defaults to Secure Boot. If you're trying to boot from a "live CD" in a USB stick, it will error out with a "secure boot violation." This can be disabled from the graphical configuration interface that comes up when pressing F2 as the computer boots and following these steps as documented by Intel

Partitioning the SSD

NixOS recommends 512MB for the boot partition, 8GB for swap and the rest for the main partition. I didn't want to stray from that even though I have a 1TB disk and 32GB RAM (which some sources say should be given up to 38GB swap, even then the commands in the installation summary seems to miss a few things for these kinds of disks.

Creating the main partition went as documented by NixOS:

# parted /dev/sda -- mklabel gpt
# parted /dev/sda -- mkpart primary 512MiB -8GiB

However, when creating the the swap partition, I got the not aligned warning someone else found; just as the Arch Linux wiki warns, the alignment depends on the sector size, so one can't just say "start this partition at 8 GiB from the end" because that may not align depending on the sector size (in my case, 2048s.) I didn't want to "approximate" using percentage points as the aforementioned nixos ticket says, potentially losing some swap size. Fortunately, I found this rando post that does a deeper dive into this issue... except that the post was useless for my particular issue (a swap partition, not the main partition...) however, a comment in the post gave me what I needed:

it internally generates a range of acceptable values. This range is centered on the value you specify, and extends equally on both sides by half the unit size you used Since optimal alignment typically seems to be 1MiB-aligned, the K and M units will often not have sufficient room to reach optimal alignment. Specifying positions in G should have plenty room, but % is usually also fine.

So, the swap partition command in my case worked (with no warnings and no problems for the next step, the boot partition: )

# parted /dev/sda -- mkpart swap linux-swap -8GB 100%

Literally, just say 8GB instead of 8GiB to let parted figure out exactly where to start the partition between 7.5GB and 8.5GB instead of trying to force it to start at exactly 8GiB. Note also that I gave the partition the label swap, instead of primary, which it seems is a mistake in the current nixos documentation

The remaining commands (reproduced below) work just as documented, as well as the rest of the guide.

# parted /dev/sda -- mkpart ESP fat32 1MiB 512MiB
# parted /dev/sda -- set 3 esp on

Customizing the config

I'm trying to get XMonad going alongside a few things similar to what gvolpe is using out there, will update this post as that progresses!