{ fetchurl, writeText, libguestfs-with-appliance, pkgsCross, qemu, runCommand , writeShellApplication, sshPassword, sshPort, httpPort }: let updateName = "remarkable-ct-prototype-image-3.16.1.0-ferrari-public"; updateArchive = fetchurl { url = # TODO: this is not an official source. might be worth authenticating the updates "https://storage.googleapis.com/remarkable-versions/${updateName}.swu"; hash = ""; }; xochitlConfig = writeText "xochitl.conf" '' [General] DeveloperPassword=${sshPassword} wifion=false WebInterfaceEnabled=true IdleSuspendDelay=0 SuspendPowerOffDelay=0 ''; usbMacAddr = "52:54:00:12:34:56"; ifnameUdevRule = writeText "70-persistent-net.rules" '' SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", \ ATTR{address}=="${usbMacAddr}", \ ATTR{type}=="1", KERNEL=="eth*", NAME="usb0" ''; xochitlService = writeText "xochitl.service" '' [Unit] Description=reMarkable main application After=home.mount network.target [Service] ExecStart=/usr/bin/xochitl --system Restart=always # required to make xochitl run # Environment=LD_PRELOAD=/usr/lib/libfakefbdev.so # TODO uncomment? [Install] WantedBy=multi-user.target ''; fakefbdev = pkgsCross.remarkable2.gcc11Stdenv.mkDerivation { name = "fakefbdev"; src = ./fakefbdev; installFlags = [ "DESTDIR=${placeholder "out"}" ]; }; rootfsImage = runCommand "rm-rootfs.ext4" '' cpio -i --file ${updateArchive} gzip -dc ${updateName}.ext4.verity.gz > $out ''; diskImage = runCommand "rm-disk.qcow2" { nativeBuildInputs = [ qemu libguestfs-with-appliance ]; } '' qemu-img create -f qcow2 $out 8G guestfish --rw --blocksize=512 --add $out <