aboutsummaryrefslogtreecommitdiff
path: root/nix/rootfs.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix/rootfs.nix')
-rw-r--r--nix/rootfs.nix20
1 files changed, 16 insertions, 4 deletions
diff --git a/nix/rootfs.nix b/nix/rootfs.nix
index 4a771be..fc5d321 100644
--- a/nix/rootfs.nix
+++ b/nix/rootfs.nix
@@ -1,13 +1,25 @@
-{ stdenv, fetchgit, busybox }:
+{ stdenv, fetchgit, busybox, squashfsTools }:
stdenv.mkDerivation {
name = "rootfs-yerba";
src = ./.;
+ buildInputs = [ squashfsTools ];
+ nativeBuildInputs = [ squashfsTools ];
buildPhase = ''
- echo "todo actually build rootfs"
- mkdir -p $out
+ 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 "todo actually install rootfs"
+ echo "rootfs built"
'';
}