The system is launched using a systemd soft-reboot. The nixctl script will
mount the nixos directory on /run/nextroot. This will cause systemd to use
it as a new root when rebooting. The NixOS stage2 init script at sbin/init
will be started, booting the full NixOS system.
Advantages:
- No changes on reMarkable root partition.
- Full isolation between NixOS and main system.
- A simple reboot will restart into xochitl.
Disadvantages:
- NixOS doesn't manage the linux kernel.
To use nixos, build the config.system.build.image:
nix build .#nixosConfigurations.example.config.system.build.imageThis will put a tarball in result/tarball/rm-nixos.tar.xz, which can be copied
over and extracted on the remarkable 2:
scp result/tarball/rm-nixos.tar.xz root@<remarkable>:
ssh root@<remarkable>
> mkdir -p nixos
> tar -C nixos -xJf rm-nixos.tar.xzDon't forget to create a separate directory before extracting, otherwise you'll pollute the home directory.
Now the system can be launched by starting the launch script, make sure to stop xochitl / rm2fb first:
# Should technically happen automatically as nixos Conflicts with this,
# but doesn't hurt:
> systemctl stop xochitl rm2fb
> ./nixos/nixctl launchNow a new rm2fb server will be running, with an instance of yaft_reader that
shows the kernel log, which is useful for debugging.
To start NixOS, reboot into it. Each of these commands will do the same:
> systemctl soft-reboot
> systemctl reboot
> rebootTo exit NixOS, simply reboot again.
nixctl copies your saved wifi networks over from xochitl's config on every
boot, so it works out of the box on NixOS too. It copies both the
wpa_supplicant-style wifi_networks.conf and any NetworkManager
*.nmconnection profiles it finds; only the one actually in use is picked
up, based on which config.nix option you enable, matching your xochitl
version:
networking.wireless.enable = true;for xochitl < 3.28 (wpa_supplicant).networking.networkmanager.enable = true;for xochitl >= 3.28 beta (NetworkManager). Add your login user to thenetworkmanagergroup, otherwise it can't talk to NetworkManager over D-Bus.
The nixctl install command will install NixOS so that it automatically starts
when the system is rebooted from xochitl. The nixos uninstall command should
remove all traces from the system partition.
A QEMU based vm is available at config.system.build.vm:
nix build .#nixosConfigurations.example.config.system.build.vm
./result
# Wait for boot, login as rootThis VM boots into NixOS directly.
To boot into xochitl first use config.system.build.vm-xochitl.
- Test wpa_supplicant conf copy.
- Test
nixos-rebuildfrom host. - Split
./configuration.nixinto separate modules. - Create xochitl chroot.
- Re-create wrapWithPreload, rm2-stuff program modules.
- Write rocket launcher systemd unit.
- Rework launch, allow install.
- reMarkable document sync.
- Fix koreader spamming 'WARN Polling for input events returned an error:'
- Make vm that starts rm2-emu automatically.
- NixOS tests.
- Make xochitl run as a user?
- Minimize size
- Drop nixos tools, don't use
-ngto lose python dep. - Correctly start user session for Rocket.
- Usb ethernet.