[Nix-dev] Building a self-sufficient initrd

Marc Weber marco-oweber at gmx.de
Wed Aug 13 09:28:05 CEST 2008


On Wed, Aug 13, 2008 at 05:10:29PM +1000, Andrew Tunnell-Jones wrote:
> 
>  Hi all,
> 
>  I'd like to be able to build self-contained (no reliance on storage - local, 
>  network or otherwise to bring up system) NixOS initrd's. I've tried to work 
>  out how to do this myself by dismantling system/system.nix, 
>  boot/make-initrd.nix, et al but haven't gotten anywhere. Can anyone offer 
>  any suggestions or an example config of how to do this?

Don't think there is really a configuration option for it yet..
Basically all you need is the boot/*-stage-1* files
The stage-1 one is the sh script copied to initrd and started there.

I guess that

  initialRamdisk = pkgs.makeInitrd {
    contents = [
      { object = bootStage1;
        symlink = "/init";
      }

tells the makeInitrd which closures to put on the disk (all deps of
bootStage1)
So all you have to do is add your application as path somehow to the
bootStage1 (so that they are referenced as runtime dependencies)

If I haven't helped you maybe you need to rephrase your question.

Sincerly
Marc Weber



More information about the nix-dev mailing list