aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArslaan Pathan <[email protected]>2026-06-10 20:06:29 +1200
committerArslaan Pathan <[email protected]>2026-06-10 20:06:29 +1200
commit58b1499d3431700d999a5164f7e5a22706adc35d (patch)
treeee7b285208767f1427ad217727b760553dd69ba2
parent5e2fe0cdbe0da7e1082d273a0295fdad44614a48 (diff)
downloadyerbalinux-58b1499d3431700d999a5164f7e5a22706adc35d.tar.xz
yerbalinux-58b1499d3431700d999a5164f7e5a22706adc35d.zip
Add runit
-rw-r--r--flake.nix3
-rw-r--r--nix/rootfs.nix30
-rwxr-xr-xrunit/13
-rwxr-xr-xrunit/22
-rwxr-xr-xrunit/32
-rwxr-xr-xrunit/sv/getty-tty0/run2
-rwxr-xr-xrunit/sv/getty-ttyS0/run2
7 files changed, 36 insertions, 8 deletions
diff --git a/flake.nix b/flake.nix
index a9ca70d..ddfe10b 100644
--- a/flake.nix
+++ b/flake.nix
@@ -18,12 +18,13 @@
busybox = pkgs.callPackage ./nix/busybox.nix {
inherit (pkgs) pkgsStatic;
};
+ runit = pkgsMusl.runit;
limine = pkgs.callPackage ./nix/limine.nix {};
initramfs = pkgs.callPackage ./nix/initramfs.nix {
inherit (self.packages.${system}) kernel busybox;
};
rootfs = pkgs.callPackage ./nix/rootfs.nix {
- inherit (self.packages.${system}) busybox;
+ inherit (self.packages.${system}) busybox runit;
inherit (pkgsMusl) musl;
};
iso = pkgs.callPackage ./nix/iso.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
diff --git a/runit/1 b/runit/1
new file mode 100755
index 0000000..370b525
--- /dev/null
+++ b/runit/1
@@ -0,0 +1,3 @@
+#!/bin/sh
+mount -a
+hostname -F /etc/hostname 2>/dev/null || hostname yerba-live
diff --git a/runit/2 b/runit/2
new file mode 100755
index 0000000..91158e9
--- /dev/null
+++ b/runit/2
@@ -0,0 +1,2 @@
+#!/bin/bash
+exec runsvdir /etc/service
diff --git a/runit/3 b/runit/3
new file mode 100755
index 0000000..43e2ad1
--- /dev/null
+++ b/runit/3
@@ -0,0 +1,2 @@
+#!/bin/sh
+# this is the shutdown thing i think? nothing here yet
diff --git a/runit/sv/getty-tty0/run b/runit/sv/getty-tty0/run
new file mode 100755
index 0000000..df22125
--- /dev/null
+++ b/runit/sv/getty-tty0/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /sbin/getty -L tty0 115200 vt100
diff --git a/runit/sv/getty-ttyS0/run b/runit/sv/getty-ttyS0/run
new file mode 100755
index 0000000..d02722e
--- /dev/null
+++ b/runit/sv/getty-ttyS0/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /sbin/getty -L ttyS0 115200 vt100