Using Nixos on an external M.2 SSD drive

I like to use Linux on an external M.2. SSD drive. It allows me to use Linux on nearly any computer I encounter, laptops and desktops alike.

For a couple of years, I’ve been using Fedora. Since reproducibility is much easier on NixOS, I switched over.

For the most part, most hardware configs seem to work out of the box, perhaps thanks to the Linux kernel support. I haven’t had any direct issues with using Nvidia, AMD, or Intel GPUs. However, I have seen a handful of different configs I could use, such as:

  1. AMD GPU - NixOS Wiki
  2. Laptop - NixOS Wiki
  3. Nvidia - NixOS Wiki

My question is, do I need to use these configs?
Will using some of these configs, such as the laptop configs, help in battery and CPU/GPU performance?
Is it normal to mix and match various CLs for my configuration.nix file?

An option would be to use specialisations. You could a specialisation for each different configuration and those would be visible on the boot screen to choose from.


Yes, but it’s pretty tricky to get the “right” one.

nvidia GPUs for example will perform abysmally with the default nouveau driver because it’s completely incapable of driving the powermanagement features of anything resembling a modern card. It’ll suffice to drive a desktop, since a low clockrate is enough for that, but anything more intensive will be difficult.

There are a lot of different possible hardware setups that take a bit of effort, know-how and peering at lspci to get to run properly though, because especially for laptops it’s often not just either of nvidia/intel/amd, but actually often amd + nvidia, intel + amd or intel + nvidia. In those cases, the physical location the individual cards are mounted to will matter as well.

And that’s just GPUs, add to this various motherboard’s behavior for USB idle shutoffs, keyboard backlights, display backlights, light sensors, … I think it’s practically impossible to get a set of specializations that support the full range of possible systems perfectly. In a way the project closest to achieving something like that is nixos-hardware.

Making one or two for the systems you use the most, and leaving a generic one that just sticks with the basic kernel settings as with an install USB could work, though, I suppose.