Skip to content

Instantly share code, notes, and snippets.

@DarkOnion0
Last active June 3, 2023 12:29
Show Gist options
  • Save DarkOnion0/44493c8786460d6464c1375c25fb3343 to your computer and use it in GitHub Desktop.
Save DarkOnion0/44493c8786460d6464c1375c25fb3343 to your computer and use it in GitHub Desktop.
Basic android nix-shell

Android nix-shell

This is a basic sample of a nix-shell for android flashing

Installation

curl --progress-bar \
 https://gist.githubusercontent.com/DarkOnion0/44493c8786460d6464c1375c25fb3343/raw/16fcc1133e752aaaeeb30bf07fda90812fde4cd5/default.nix > /tmp/android-shell.nix \
 && nix-shell /tmp/android-shell.nix
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
shellHook = ''
echo -e "Hello world from the android nix-shell"
tips () {
echo -e "\nUsefull links:"
echo -e "============================================================="
echo -e "Recovery (TWRP) | https://twrp.me/Devices/"
echo -e "OS (/e/ os) | https://doc.e.foundation/devices"
echo -e "OS (lineageOS) | https://lineageos.org/"
echo -e "Android help forum (xda) | https://www.xda-developers.com/"
echo -e "============================================================="
echo -e "\nCommand info:"
echo -e "====================================================================================="
echo -e "adb == when device is running the os / inside the adb sideload mode in the recovery"
echo -e "fastboot == every other time when it's not adb"
echo -e "====================================================================================="
echo -e "\nBasic command :"
echo -e "===================================================================================================================="
echo -e "adb/fastboot devices | list the connected devices"
echo -e "adb/fastboot reboot {bootloader, fastboot} | reboot android device to the wanted state (the arg in {} can be omited)"
echo -e "\nadb sideload [FILE] | flash an os to an android device"
echo -e "\nfastboot boot [FILE] | flash a recovery to an android device"
echo -e "===================================================================================================================="
}
tips
# The adb server must be run as root to be able to connect to device
#adb kill-server
sudo adb start-server
'';
# nativeBuildInputs is usually what you want -- tools you need to run
nativeBuildInputs = [
# Android default tools
pkgs.android-tools
# Samsung tool
pkgs.heimdall
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment