backends/alpine.sh (2013 bytes)
1 # Alpine: apk --root from the live system. OpenRC, eudev, seatd, dbus. 2 # shellcheck shell=sh disable=SC2034 3 bootstrap() { 4 mkdir -p $M/etc/apk/keys $M/etc/mkinitfs 5 cp /etc/apk/keys/* $M/etc/apk/keys/ 6 grep '^http' /etc/apk/repositories > $M/etc/apk/repositories 7 apk add -q --root $M --initdb alpine-base 8 chroot_mounts 9 echo 'features="ata base cryptsetup ext4 keymap mmc nvme scsi usb virtio"' > $M/etc/mkinitfs/mkinitfs.conf 10 fw=linux-firmware; [ "${FIRMWARE:-}" = no ] && fw=linux-firmware-none 11 ch "apk add -q linux-lts $fw mkinitfs cryptsetup e2fsprogs eudev seatd dbus shadow \ 12 mesa-dri-gallium font-dejavu fontconfig" 13 for s in devfs dmesg udev udev-trigger udev-settle; do ch "rc-update -q add $s sysinit"; done 14 for s in modules sysctl hostname bootmisc syslog hwclock; do ch "rc-update -q add $s boot"; done 15 for s in networking seatd dbus; do ch "rc-update -q add $s default"; done 16 for s in killprocs savecache mount-ro; do ch "rc-update -q add $s shutdown"; done 17 printf 'auto lo\niface lo inet loopback\n\nauto eth0\niface eth0 inet dhcp\n' > $M/etc/network/interfaces 18 } 19 pkg() { case $1 in pipewire) echo "pipewire pipewire-pulse" ;; river) echo river-classic ;; *) echo "$1" ;; esac; } 20 pkg_install() { ch "apk add -q $*"; } 21 extra_pkgs() { :; } 22 user_add() { 23 ch "adduser -D -s /bin/sh $1" 24 for g in wheel video input audio seat; do ch "addgroup $1 $g" 2>/dev/null || true; done 25 } 26 serial_getty() { echo 'ttyS0::respawn:/sbin/getty -L 115200 ttyS0 vt100' >> $M/etc/inittab; } 27 nix_native() { ch "apk add -q nix"; } 28 nix_service() { ch "rc-update -q add nix-daemon default"; } 29 boot_cmd() { 30 printf '#!/bin/sh\n%s\n' "$1" >> $M/etc/local.d/waybase.start 31 chmod 755 $M/etc/local.d/waybase.start 32 ch "rc-update -q add local default" 33 } 34 kernel() { 35 ch "mkinitfs \$(ls /lib/modules | head -1)" >/dev/null 36 KERNEL=vmlinuz-lts INITRD=initramfs-lts 37 KARGS="modules=sd-mod,usb-storage,ext4" 38 CRYPTARGS="cryptroot=UUID=$UL cryptdm=root" 39 }