Cached NixOS and Derivation for Machine < 2GB RAM


So I have been appointed to teach Linux OS to student (around 30 computers), and I want to teach NixOS (this is part of my Functional Course). However, the spec of Machine is:

  • OS: Windows
  • RAM 2GB
  • HDD 500GB

I want to teach both Haskell and how to code Haskell in NixOS, but when I tried to install NixOS using virtualBox, it needs at least 2GB RAM of VM.

I don’t know how to approach this situation, as I can’t upgrade the machine. Maybe someone can point me to the right direction?

Maybe you can build base VBox image with NixOS on some powerful machine

and then transfer it to Windows one.

Is it possible to boot the machine onto a USB stick?

2GB is quite tight for Haskell development as well, this will be giving you some more breathing room.

For the root partition, I wonder how efficient it would be to mount the C: drive, create a file in it, partition it as ext4 and then mount that as the root filesystem. With the USB stick as the /boot partition, it means the student can reboot and experience the full NixOS experience.

For big compilations, it’s possible to use a bigger machine to populate a binary cache.

Hi, thank you I will look into it.

By saying that, I need 30 usb stick for each computer? so the usb stick will contain pre-installed nixos (with my custom installation). The best option will be use USB stick as /boot partition instead of mount the C: drive?

is there any documentation about populate a binary cache?

There are many ways to do what you want, it depends on your constraints actually.

I am assuming that you don’t want to touch the windows installation and don’t want to re-partition the machines either as they are probably managed by the school sysadmin. If that is not the case you can reduce the number of USB sticks as you can use them just to install the system and don’t depend on them for further booting.

To create a binary cache, use the nix copy <FLAGS>... <INSTALLABLES>... command. There are multiple possible targets. For example if you could have a web server service the build results, or copy the results onto a S3 bucket.