1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-18 13:31:36 +03:00
mobile-nixos/boot/init/main.rb
2020-02-03 16:19:10 -05:00

44 lines
970 B
Ruby

# TODO: Allow defining depending on stage-0/stage-1.
STAGE = 1
FAILURE_SLEEP = 10
log("************************")
log("* Mobile NixOS stage-#{STAGE} *")
log("************************")
log("")
log("TODO: embed build information...")
log("")
Tasks::Splash.new("stage-0")
Tasks::Symlink.new("/proc/mounts", "/etc/mtab")
Tasks::Mount.new("/dev/pts", type: "devpts")
.add_dependency(:Files, "/dev/")
Tasks::Mount.new("/dev", type: "devtmpfs")
Tasks::Mount.new("/proc", type: "proc")
Tasks::Mount.new("/sys", type: "sysfs")
[
"/proc",
"/sys",
"/dev",
"/tmp",
"/run",
"/lib",
"/mnt",
"/etc/udev",
"/var/log",
].each do |dir|
Tasks::Directory.new(dir)
end
Tasks::Splash.new("stage-1")
.add_dependency(:SingletonTask, :UDev)
Tasks::Mount.new("/dev/disks/by-label/NIXOS", "/mnt")
Tasks::go()
$logger.fatal("Tasks all ran, but we're still here...")
$logger.fatal("Sleeping for #{FAILURE_SLEEP} seconds then exiting...")
sleep(FAILURE_SLEEP)
exit(99)