Pareto Optimal Dev

installing NixOS using devos and nix flakes

Create a live usb with the latest NixOS 21.11

Follow instructions for Copying it to a usb stick but with a progress bar and larger block size

So that means:

dd if=path-to-image of=/dev/sdX bs=4096 status=progress

go for a short walk

run the sync command to flush caches because I’m paranoid

Boot into the live cd with no issues

Wow Linux setup has come a long way!

open a terminal as root

Clone my devos fork

git clone git@github.com:ParetoOptimalDev/system.git

Enter system and run nix-shell

Do a 5m yoga session

Partition for dual booting windows

Roughly you can follow https://nixos.org/manual/nixos/stable/index.html#sec-installation-partitioning

In gparted

resize the windows partition to make room for the nixos and swap partitions and label them

I’ll re-use the already created boot partition

That means I’ll mount it differently from the instructions later

wait a bit, surprisingly this completed in just a couple minutes

Mount partitions

Roughly follow https://devos.divnix.com/start/bootstrapping.html#mount-partitions with some differences

mount /dev/disk/by-label/nixos /mnt

one difference being the already created EFI boot partition was named SYSTEM

mkdir -p /mnt/boot && mount /dev/disk/by-label/SYSTEM /mnt/boot

swapon /dev/disk/by-label/swap

  mkdir -p /mnt/tmpstore/{work,store}
mount -t overlay overlay -olowerdir=/nix/store,upperdir=/mnt/tmpstore/store,workdir=/mnt/tmpstore/work /nix/store

Do the hardware configuration correctly unlike me the first time

Start installing from flake

nixos-install --flake .#NixOS

Go watch a tv show

type in a root password

reboot and pull out live usb

Do the hardware configuration correctly

I had to do this but luckily you can do it right the first time

select nixos, it hangs on waiting for /dev/disk/by-id/nixos to appear :S

put live usb back in, hit r to reboot, hit F12 to select usb drive as boot device

figure out what’s wrong

for some reason it’s not finding nixos by label

we’ll generate a custom hardware configuration

run bud up

verify these records look okay in hosts/NixOS/hardware-configuration.nix

Something like:

fileSystems."/" =
  { device = "/dev/disk/by-uuid/your-linux-partition-uuid";
    fsType = "ext4";
  };

fileSystems."/boot" =
  { device = "/dev/disk/by-uuid/your-boot-partition-uuid";
    fsType = "vfat";
  };

now you’re ready to install and hopefully boot successfully in the next step

I actually think this isn’t supposed to be necessary

The default NixOS host has:

fileSystems."/" = { device = "/dev/disk/by-label/nixos"; };

but IIRC my error said something like:

Couldn’t find /dev/disk/by-id/nixos

So maybe there’s a boot loader generation bug where label should be used rather than id

I’ll tag it with issues with DevOS for now and maybe post an upstream issue later.

start Customizing devos after install for my use-cases