Custom NixOS image to boot from USB and run from RAM

Just wanted to let you know that I’m fairly new to NixOS and just starting out on my journey.

I’m interested in creating a Nix system that boots from USB and runs with all data in RAM so that I can remove the USB stick during run. Maybe even /nix/store could also live in RAM, possibly as a unionfs of a squashfs base and a writable top filesystem.

I’ve heard about the copytoram boot parameter and also found some helpful information on how to customize an image for booting from a USB flash drive. Can anyone provide further guidance or advice on how to achieve this? Thanks in advance!

The most important question for me would be:

How can I define the boot parameters like copytoram when creating a USB bootable NixOS?

Then I could experiment more with the created image.

  boot.kernelParams = [ "copytoram" ];
1 Like