Thanks to visit codestin.com
Credit goes to github.com

Skip to content

mwlaboratories/phoneputer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NixOS Mobile Tutorial for OnePlus 6 (enchilada)

1 Overview

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

2 Clone Your Configuration Repository

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 phoneputer

3 Build Flashable Images

We 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

4 Prepare the Phone

4.1 Update OxygenOS

  1. Update OxygenOS to the latest official version
  2. Remove all Google accounts to avoid FRP (Factory Reset Protection) blocks

4.2 Enable Developer Options

  1. Go to Settings → About Phone
  2. Tap “Build Number” 7 times
  3. Go back to Settings → Developer Options
  4. Enable “USB Debugging”
  5. Enable “OEM Unlocking”

4.3 Unlock the Bootloader

Open a nix-shell with Android tools:

nix-shell -p adb-sync android-tools

Check device connection:

adb devices

Reboot to bootloader:

adb -d reboot bootloader

Unlock bootloader (this will erase all data!):

fastboot oem unlock

⚠️ **Warning**: Unlocking the bootloader will erase all data on your device!

4.4 Copy Partitions (A/B Safety Trick)

In 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:

  1. On the device, select “Apply Update”, then “Apply from ADB” to begin sideload
  2. 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.zip

Now reboot to recovery by tapping “Advanced”, then “Reboot to recovery”.

4.5 Prepare for Mainline

This assumes the phone will only run SDM845 mainline images. You will need to erase the dtbo partitions for both slots:

fastboot erase dtbo_a
fastboot erase dtbo_b

5 Flash Images to Device

Flash the critical partitions:

./result/flash-critical.sh

Flash system image:

fastboot flash userdata system.img

⚠️ **Note**: If the phone isn’t recognized, try connecting it after booting into fastboot mode.

6 First Boot and Configuration

6.1 SSH into the Phone

NixOS 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-

6.2 Clone Your Configuration Repository

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 phoneputer

6.3 Rebuild with Your Flake Configuration

nixos-rebuild switch --flake .#phoneputer

7 What’s Next?

After 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

8 Resources

About

nixos on your phone

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages