From 58b1499d3431700d999a5164f7e5a22706adc35d Mon Sep 17 00:00:00 2001 From: Arslaan Pathan Date: Wed, 10 Jun 2026 20:06:29 +1200 Subject: Add runit --- nix/rootfs.nix | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'nix') diff --git a/nix/rootfs.nix b/nix/rootfs.nix index 34f1b4e..44532cc 100644 --- a/nix/rootfs.nix +++ b/nix/rootfs.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchgit, busybox, squashfsTools, linuxHeaders, musl }: +{ stdenv, fetchgit, busybox, squashfsTools, linuxHeaders, musl, runit }: stdenv.mkDerivation { name = "rootfs-yerba"; @@ -10,6 +10,8 @@ stdenv.mkDerivation { mkdir -p rootfs mkdir -p rootfs/{bin,sbin,etc,proc,sys,dev,home,var,usr,root,mnt,tmp,lib} mkdir -p rootfs/usr/{lib,bin} + mkdir -p rootfs/etc/runit + mkdir -p rootfs/etc/service chmod -R u+w rootfs # Basic setup end @@ -23,21 +25,35 @@ stdenv.mkDerivation { # Busybox start cp -a ${busybox}/_install/. rootfs/ - chmod -R u+w rootfs - ln -sf /bin/busybox rootfs/init + # chmod -R u+w rootfs + # ln -sf /bin/busybox rootfs/init # Busybox end + # runit start + cp -a ${runit}/bin/* rootfs/usr/bin + chmod -R u+w rootfs + ln -sf /usr/bin/runit-init rootfs/init + chmod -R u+w rootfs + rm rootfs/sbin/init + chmod -R u+w rootfs + ln -sf /usr/bin/runit-init rootfs/sbin/init + cp -a ${../runit}/* rootfs/etc/runit/ + chmod -R u+w rootfs + ln -sf /etc/runit/sv/getty-tty0 rootfs/etc/service/ + chmod -R u+w rootfs + ln -sf /etc/runit/sv/getty-ttyS0 rootfs/etc/service/ + # runit end + # Programs start + # nothing here yet! # Programs end # Basic files setup start 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 "tty0::askfirst:/bin/sh" >> rootfs/etc/inittab - echo "ttyS0::askfirst:/bin/sh" >> rootfs/etc/inittab - echo "::ctrlaltdel:/sbin/reboot" >> rootfs/etc/inittab + echo "root:x:0:0:root:/root:/bin/sh" > rootfs/etc/passwd + echo "root:x:0:" > rootfs/etc/group echo "yerba-live" > rootfs/etc/hostname # Basic files setup end -- cgit v1.2.3