Snippets

Brian McKenna nixpkgs chroot for Chromebooks

Created by Brian McKenna
#!/bin/sh

ROOT=/usr/local/nixroot
USERNAME=chronos

echo 'Y' > /sys/kernel/debug/dri/drm_master_relax

mountdir() {
  mkdir -p $ROOT/$1
  mount --bind /$1 $ROOT/$1
}

mountdir bin
mountdir lib64
mountdir usr/bin
mountdir usr/lib64
mountdir usr/share
mountdir etc
mountdir var
mountdir run

mountdir tmp
mount -i -o "remount,exec" $ROOT/tmp

mountdir proc
mountdir dev
mount --bind /dev/pts $ROOT/dev/pts
mountdir sys

mkdir -p $ROOT/home/chronos/user
mount --bind /home/chronos/user $ROOT/home/chronos/user

echo "Launching shell with nix-* tools!"
exec env -i TERM="$TERM" chroot "$ROOT" su - "$USERNAME" # "$@"

Comments (0)