aboutsummaryrefslogtreecommitdiff
path: root/nix/rootfs.nix
diff options
context:
space:
mode:
authorArslaan Pathan <[email protected]>2026-06-08 13:10:01 +1200
committerArslaan Pathan <[email protected]>2026-06-08 13:10:01 +1200
commit9dad8b47c18fd4b2d919d90b33b8d7d093a3dac2 (patch)
tree5b2a221056404859436d2e5913dfbe63d812eb18 /nix/rootfs.nix
parenteb6c31a34d289215cd773468575c1432a82794a7 (diff)
downloadyerbalinux-9dad8b47c18fd4b2d919d90b33b8d7d093a3dac2.tar.xz
yerbalinux-9dad8b47c18fd4b2d919d90b33b8d7d093a3dac2.zip
Add rootfs target, make initramfs output to $out for convenience rather than $out/initramfs.cpio.gz, start working on iso target
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"
'';
}