{ stdenv, fetchgit, busybox, squashfsTools }: stdenv.mkDerivation { name = "rootfs-yerba"; src = ./.; buildInputs = [ squashfsTools ]; nativeBuildInputs = [ squashfsTools ]; buildPhase = '' mkdir -p rootfs mkdir -p rootfs/{bin,sbin,etc,proc,sys,dev,home,var,usr,root,mnt,tmp} cp -a ${busybox}/_install/. rootfs/ # this says permission denied, cant be bothered to debug, let's just hope we can chroot to /sbin/init in the initramfs and it works? # ln -sf sbin/init rootfs/init echo "proc /proc proc defaults 0 0" > rootfs/etc/fstab echo "sysfs /sys sysfs defaults 0 0" >> rootfs/etc/fstab echo "devtmpfs /dev devtmpfs defaults 0 0" >> rootfs/etc/fstab echo "::sysinit:/bin/mount -a" > rootfs/etc/inittab echo "::askfirst:/bin/sh" >> rootfs/etc/inittab echo "::ctrlaltdel:/sbin/reboot" >> rootfs/etc/inittab mksquashfs rootfs $out -comp zstd -noappend ''; installPhase = '' echo "rootfs built" ''; }