diff options
Diffstat (limited to 'server.nix')
-rw-r--r-- | server.nix | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/server.nix b/server.nix index dc4fcd6..d8f5d2d 100644 --- a/server.nix +++ b/server.nix @@ -12,19 +12,19 @@ httpPort, }: let - updateName = "remarkable-production-memfault-image-3.14.1.9-rm2-public"; + updateName = "remarkable-production-image-3.20.0.92-rm2-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 = "sha256-8zlAGdv+w2KO7BruRQLQC9ivGSHtK82e36ASIeRF3zI="; + hash = "sha256-GK3CX/P2MXbX4AZsu8dvu00/id8R1FB9aVvqHOjTJos="; }; xochitlConfig = writeText "xochitl.conf" '' [General] DeveloperPassword=${sshPassword} - wifion=false + AirplaneMode=true WebInterfaceEnabled=true IdleSuspendDelay=0 SuspendPowerOffDelay=0 @@ -38,6 +38,11 @@ let ATTR{type}=="1", KERNEL=="eth*", NAME="usb0" ''; + mmcSymlinkUdevRule = writeText "" '' + ACTION=="add", KERNEL=="vda", SYMLINK+="mmcblk2" + ACTION=="add", KERNEL=="vda[0-9]", SYMLINK+="mmcblk2p%n" + ''; + usbNetworkConfig = writeText "10-usb.network" '' [Match] Name=usb* @@ -49,18 +54,24 @@ let xochitlService = writeText "xochitl.service" '' [Unit] Description=reMarkable main application - After=home.mount network.target + DefaultDependencies=no + Conflicts=shutdown.target + Before=shutdown.target + Wants=rm-sync.service + After=var-lib-uboot.mount dbus.socket + Requires=dbus.socket [Service] ExecStart=/usr/bin/xochitl --system - Restart=always + Restart=on-failure + NotifyAccess=all # required to make xochitl run Environment=LD_PRELOAD=/usr/lib/libfakefbdev.so [Install] WantedBy=multi-user.target ''; - + fakefbdev = pkgsCross.armv7l-hf-multiplatform.gcc11Stdenv.mkDerivation { name = "fakefbdev"; src = ./fakefbdev; @@ -89,7 +100,7 @@ let guestfish --rw --blocksize=512 --add $out <<EOF run - # not the original partition table of the RM2 + # not the original partition table of the RM2, sizes differ part-init /dev/sda gpt part-add /dev/sda p 2048 2099199 part-add /dev/sda p 2099200 10487807 @@ -100,30 +111,26 @@ let upload ${rootfsImage} /dev/sda2 resize2fs /dev/sda2 # we disable the orphan_file feature to avoid the error - # '/dev/vda4 has unsupported feature(s): FEATURE_C12' - # when e2fsck runs at boot + # 'unsupported feature(s): FEATURE_C12' when e2fsck runs at boot mkfs ext4 /dev/sda4 features:^orphan_file mount /dev/sda2 / - copy-in ${kernel}/lib/modules /lib - - download /etc/fstab fstab - ! sed -i 's/mmcblk2p/vda/' fstab - upload fstab /etc/fstab + copy-in ${kernel}/lib/modules /usr/lib upload ${ifnameUdevRule} /etc/udev/rules.d/70-persistent-net.rules + upload ${mmcSymlinkUdevRule} /etc/udev/rules.d/70-mmc-symlinks.rules upload ${usbNetworkConfig} /etc/systemd/network/10-usb.network - upload ${xochitlService} /lib/systemd/system/xochitl.service + upload ${xochitlService} /usr/lib/systemd/system/xochitl.service # delete any systemd units that hinder or delay startup - rm /lib/systemd/system/kdump.service - rm /lib/systemd/system/wacom_flash.service - rm /lib/systemd/system/memfaultd.service - rm /lib/systemd/system/swupdate.service - rm /lib/systemd/system/swupdate.socket - rm /etc/systemd/system/multi-user.target.wants/busybox-ifplugd@usb1.service + rm /usr/lib/systemd/system/wacom_flash.service + rm /usr/lib/systemd/system/memfaultd.service + rm /usr/lib/systemd/system/swupdate.service + rm /usr/lib/systemd/system/swupdate.socket + rm /usr/lib/systemd/system/system-hardening.service + rm /usr/lib/systemd/system/wpa_supplicant.service upload ${fakefbdev}/lib/libfakefbdev.so /usr/lib/libfakefbdev.so chmod 0755 /usr/lib/libfakefbdev.so |