$ nix-build -A initrd

An initrd is a temporary root file system living in memory. It is part of the startup process and provides an early user-space to prepare the system before the real root file system can be mounted.

In particular in our case, it packages busybox. Given we are using a gzipped cpio archive with an init script, Wikipedia suggests we are actually using the initramfs scheme instead of the initrd scheme.

To explore the result, we can extract the content of the initrd in a temporary directory as follow:

$ mkdir tmp ; cd tmp
$ zcat ../result/initrd | cpio -idmv
$ find -maxdepth 3

The nixpkgs code to create the initrd is at pkgs/build-support/kernel/make-initrd.nix and pkgs/build-support/kernel/

The nixpkgs code to create the collection of modules is at pkgs/build-support/kernel/modules-closure.nix and pkgs/build-support/kernel/