NixOS installed on external SSD but unable to boot into it

Hi everybody, I tried to install NixOS on an external SSD to have a portable OS with me, but without success. I am wondering if it is even possible to have something like this.
I used a 32GB USB with NixOS installed on it via Rufus and then from there I installed NixOS on my external 1TB SSD creating three partitions: boot, swap and root.
I’m assuming this is not enough for the partition to be recognized as a bootable device.

Is there any way to achieve this?

You’d need to mark the partition as bootable, and you’d need your BIOS to support discovering it.

I’d probably have recommended doing a UEFI install. Then the installer would’ve tried to put an explicit boot entry into the UEFI for your installation. Assuming it made that entry nicely, it should work. Also, it would install the UEFI binary to the default location (at least if you use systemd-boot), and then the firmware should discover it, too.

1 Like

Yea, the boot loader is the first potential problem. The other potential problem is the drivers. When nixos generates its hardware-configuration.nix file, it assumes the hardware it will boot off of is the same as it installed onto. This probably won’t matter, because the drivers needed to boot a generic x86 system off of USB are most likely the same between most systems. But just in case, you might want to add "${modulesPath}/profiles/all-hardware.nix" to your imports to get a bunch of drivers that may or may not help booting on arbitrary machines.

2 Likes

I’m not really familiar with this. Is there a guide I can use to perform a UEFI install?

It should be covered fairly well as part of the Installation part of the NixOS Manual. The various steps have different callouts for legacy/uefi install to guide you to take the right steps.