liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

default.nix (901B)


      1 {
      2   busybox
      3 , pkgsBuildBuild
      4 , runCommand
      5 , cpio
      6 , writeReferencesToFile
      7 , writeScript
      8 } :
      9 let
     10   inherit (pkgsBuildBuild) gen_init_cpio;
     11   script =  writeScript "init" ''
     12     #!/bin/sh
     13     exec >/dev/console
     14     echo Running in initramfs
     15     PATH=${busybox}/bin:$PATH
     16     export PATH
     17     mount -t proc none /proc
     18     mount -t sysfs none /sys
     19     ${busybox}/bin/sh
     20   '';
     21   refs = writeReferencesToFile busybox;
     22 in runCommand "initramfs.cpio" { } ''
     23   cat << SPECIALS | ${gen_init_cpio}/bin/gen_init_cpio /dev/stdin > out
     24   dir /proc 0755 0 0
     25   dir /sys 0755 0 0
     26   dir /dev 0755 0 0
     27   nod /dev/console 0600 0 0 c 5 1
     28   nod /dev/mtdblock0 0600 0 0 b 31 0
     29   dir /nix 0755 0 0
     30   dir /nix/store 0755 0 0
     31   dir /bin 0755 0 0
     32   file /bin/sh  ${busybox}/bin/sh 0755 0 0
     33   file /init ${script} 0755 0 0
     34   SPECIALS
     35   find $(cat ${refs}) | ${pkgsBuildBuild.cpio}/bin/cpio -H newc -o -A -v -O out
     36   cp out $out
     37 ''