This tutorial guides you through installing NixOS Mobile on a OnePlus 6 (enchilada) device. The process involves building a minimal base image using the local.nix file (with fixes to make it build on x86 machines), flashing it to your device, then rebuilding on the phone itself (aarch64) with the full configuration.nix and flake method we’re all used to in the NixOS ecosystem.
video tutorial; https://youtu.be/yxfDNqZ9WTM
First, clone or download this phoneputer repository to get you started with a minimal config to build:
git clone https://github.com/mwlaboratories/phoneputer.git
cd phoneputerWe will import the official mobile-nixos repo to build from. It will be a folder `mobile-nixos` under our phoneputer project directory. After building, we can delete it as it is only needed to build our base image for one-time use:
git clone https://github.com/mobile-nixos/mobile-nixos.git
cd mobile-nixos
cp ../local.nix .
nix-build --argstr device oneplus-enchilada -A outputs.android-fastboot-images- Update OxygenOS to the latest official version
- Remove all Google accounts to avoid FRP (Factory Reset Protection) blocks
- Go to Settings → About Phone
- Tap “Build Number” 7 times
- Go back to Settings → Developer Options
- Enable “USB Debugging”
- Enable “OEM Unlocking”
Open a nix-shell with Android tools:
nix-shell -p adb-sync android-toolsCheck device connection:
adb devicesReboot to bootloader:
adb -d reboot bootloaderUnlock bootloader (this will erase all data!):
fastboot oem unlockIn some cases, the inactive slot can be unpopulated or contain much older firmware than the active slot, leading to various issues including a potential hard-brick. We can ensure none of that will happen by copying the contents of the active slot to the inactive slot.
To do this, sideload the copy-partitions-20220613-signed.zip package:
- On the device, select “Apply Update”, then “Apply from ADB” to begin sideload
- On the host machine, download and sideload the package:
wget https://mirrorbits.lineageos.org/tools/copy-partitions-20220613-signed.zip
adb -d sideload copy-partitions-20220613-signed.zipNow reboot to recovery by tapping “Advanced”, then “Reboot to recovery”.
This assumes the phone will only run SDM845 mainline images. You will need to erase the dtbo partitions for both slots:
fastboot erase dtbo_afastboot erase dtbo_bFlash the critical partitions:
./result/flash-critical.shFlash system image:
fastboot flash userdata system.imgNixOS Mobile provides SSH access because we set it up in the local.nix base configuration we’ve built. Connect to the device:
ssh root@-localip-Once connected to the device we will rebuild without using the local.nix but like we’re used to on a normal NixOS flake install. Adjust the configuration.nix to your liking, but I would suggest building the included one first. It will boot you into GNOME:
git clone https://github.com/mwlaboratories/phoneputer.git
cd phoneputernixos-rebuild switch --flake .#phoneputerAfter the rebuild completes, your OnePlus 6 will have:
- GNOME desktop environment (with bloat removed)
- SSH access for remote development
- Your custom package selection
- Full NixOS declarative configuration
You can now:
- Customize your configuration.nix further
- Add more packages or services
- Rebuild anytime with `nixos-rebuild switch –flake .#phone`
- Use the device as a full Linux development environment