mirror of
https://github.com/nix-community/nix-on-droid-app.git
synced 2025-11-08 19:46:10 +01:00
Rebrand as Nix / Nix-on-Droid
This commit is contained in:
parent
893d86be50
commit
9c901645f9
10 changed files with 103 additions and 17 deletions
22
README.md
22
README.md
|
|
@ -1,3 +1,24 @@
|
|||
Fork information
|
||||
================
|
||||
|
||||
Nix on Android, in a single-click installable package.
|
||||
It's kind of a mess for now, but hey, it works!
|
||||
|
||||
This repository is a fork of Termux-the-terminal-emulator used to execute
|
||||
Nix-on-Droid.
|
||||
|
||||
All credit goes to Termux:
|
||||
|
||||
* https://github.com/termux/termux-app
|
||||
* https://termux.com
|
||||
|
||||
For the script responsible for the initial bootstrap zipball generation
|
||||
please refer to https://github.com/t184256/nix-on-droid-bootstrap
|
||||
|
||||
|
||||
|
||||
Original README starts here:
|
||||
|
||||
[](https://travis-ci.org/termux/termux-app)
|
||||
[](https://gitter.im/termux/termux)
|
||||
|
||||
|
|
@ -30,3 +51,4 @@ Terminal emulators
|
|||
* xterm: The grandfather of terminal emulators. [Source](http://invisible-island.net/datafiles/release/xterm.tar.gz).
|
||||
* Connectbot: Android SSH client. [Source](https://github.com/connectbot/connectbot)
|
||||
* Android Terminal Emulator: Android terminal app which Termux terminal handling is based on. Inactive. [Source](https://github.com/jackpal/Android-Terminal-Emulator).
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ android {
|
|||
minSdkVersion 21
|
||||
targetSdkVersion 28
|
||||
versionCode 66
|
||||
versionName "0.66_v0.4_by-xeffyr"
|
||||
versionName "0.66_v0.1.0_nix"
|
||||
applicationIdSuffix ".nix"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
|
@ -30,6 +31,10 @@ android {
|
|||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
@ -38,7 +43,7 @@ dependencies {
|
|||
|
||||
preBuild.doFirst {
|
||||
assert file("./src/main/assets/bootstrap-aarch64").exists()
|
||||
assert file("./src/main/assets/bootstrap-arm").exists()
|
||||
assert file("./src/main/assets/bootstrap-i686").exists()
|
||||
assert file("./src/main/assets/bootstrap-x86_64").exists()
|
||||
//assert file("./src/main/assets/bootstrap-arm").exists()
|
||||
//assert file("./src/main/assets/bootstrap-i686").exists()
|
||||
//assert file("./src/main/assets/bootstrap-x86_64").exists()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.termux"
|
||||
android:installLocation="internalOnly"
|
||||
android:sharedUserId="com.termux"
|
||||
android:sharedUserId="com.termux.nix"
|
||||
android:sharedUserLabel="@string/shared_user_label" >
|
||||
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
||||
|
|
@ -114,6 +114,7 @@
|
|||
</intent-filter>
|
||||
</activity-alias>
|
||||
|
||||
<!--
|
||||
<provider
|
||||
android:name=".filepicker.TermuxDocumentsProvider"
|
||||
android:authorities="com.termux.documents"
|
||||
|
|
@ -124,6 +125,7 @@
|
|||
<action android:name="android.content.action.DOCUMENTS_PROVIDER" />
|
||||
</intent-filter>
|
||||
</provider>
|
||||
-->
|
||||
|
||||
<service
|
||||
android:name="com.termux.app.TermuxService"
|
||||
|
|
@ -136,11 +138,13 @@
|
|||
|
||||
<receiver android:name=".app.TermuxOpenReceiver" />
|
||||
|
||||
<!--
|
||||
<provider android:authorities="com.termux.files"
|
||||
android:readPermission="android.permission.permRead"
|
||||
android:exported="true"
|
||||
android:grantUriPermissions="true"
|
||||
android:name="com.termux.app.TermuxOpenReceiver$ContentProvider" />
|
||||
-->
|
||||
|
||||
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
|
||||
|
||||
|
|
|
|||
|
|
@ -153,8 +153,8 @@ public final class TermuxActivity extends Activity implements ServiceConnection
|
|||
|
||||
void checkForFontAndColors() {
|
||||
try {
|
||||
@SuppressLint("SdCardPath") File fontFile = new File("/data/data/com.termux/files/home/.termux/font.ttf");
|
||||
@SuppressLint("SdCardPath") File colorsFile = new File("/data/data/com.termux/files/home/.termux/colors.properties");
|
||||
@SuppressLint("SdCardPath") File fontFile = new File("/data/data/com.termux.nix/files/home/.termux/font.ttf");
|
||||
@SuppressLint("SdCardPath") File colorsFile = new File("/data/data/com.termux.nix/files/home/.termux/colors.properties");
|
||||
|
||||
final Properties props = new Properties();
|
||||
if (colorsFile.isFile()) {
|
||||
|
|
|
|||
|
|
@ -136,7 +136,11 @@ final class TermuxInstaller {
|
|||
if (!executables.isEmpty()) {
|
||||
for (String executable : executables) {
|
||||
//noinspection OctalInteger
|
||||
try {
|
||||
Os.chmod(STAGING_PREFIX_PATH + "/" + executable, 0700);
|
||||
} catch (Throwable t) {
|
||||
Log.e(EmulatorDebug.LOG_TAG, "EXECUTABLES error: " + STAGING_PREFIX_FILE + "/" + executable, t);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("Installer: no EXECUTABLES.txt found while extracting environment archive.");
|
||||
|
|
@ -144,7 +148,11 @@ final class TermuxInstaller {
|
|||
|
||||
if (!symlinks.isEmpty()) {
|
||||
for (Pair<String, String> symlink : symlinks) {
|
||||
try {
|
||||
Os.symlink(symlink.first, symlink.second);
|
||||
} catch (Throwable t) {
|
||||
Log.e(EmulatorDebug.LOG_TAG, "SYMLINKS error: " + symlink.first + " ! " + symlink.second, t);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("Installer: no SYMLINKS.txt found while extracting environment archive.");
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public final class TermuxService extends Service implements SessionChangedCallba
|
|||
|
||||
/** Note that this is a symlink on the Android M preview. */
|
||||
@SuppressLint("SdCardPath")
|
||||
public static final String FILES_PATH = "/data/data/com.termux/files";
|
||||
public static final String FILES_PATH = "/data/data/com.termux.nix/files";
|
||||
public static final String PREFIX_PATH = FILES_PATH + "/usr";
|
||||
public static final String HOME_PATH = FILES_PATH + "/home";
|
||||
|
||||
|
|
@ -269,6 +269,7 @@ public final class TermuxService extends Service implements SessionChangedCallba
|
|||
if (executablePath == null) {
|
||||
for (String shellBinary : new String[]{"login", "bash", "zsh"}) {
|
||||
File shellFile = new File(PREFIX_PATH + "/bin/" + shellBinary);
|
||||
Log.w(EmulatorDebug.LOG_TAG, "sf: " + shellFile + " " + shellFile.canExecute());
|
||||
if (shellFile.canExecute()) {
|
||||
executablePath = shellFile.getAbsolutePath();
|
||||
break;
|
||||
|
|
@ -279,6 +280,7 @@ public final class TermuxService extends Service implements SessionChangedCallba
|
|||
// Fall back to system shell as last resort:
|
||||
executablePath = "/system/bin/sh";
|
||||
}
|
||||
Log.w(EmulatorDebug.LOG_TAG, "Shell: " + executablePath);
|
||||
isLoginShell = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import java.util.List;
|
|||
public final class TermuxWidgetService extends RemoteViewsService {
|
||||
|
||||
@SuppressLint("SdCardPath")
|
||||
public static final File SHORTCUTS_DIR = new File("/data/data/com.termux/files/home/.shortcuts");
|
||||
public static final File SHORTCUTS_DIR = new File("/data/data/com.termux.nix/files/home/.shortcuts");
|
||||
|
||||
public static final class TermuxWidgetItem {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="application_name">Termux</string>
|
||||
<string name="shared_user_label">Termux user</string>
|
||||
<string name="app_failsafe_mode">Termux (failsafe)</string>
|
||||
<string name="termux_exec_permission_label">Termux:Execute</string>
|
||||
<string name="termux_exec_permission_desc">Allows application to execute arbitrary shell commands within Termux.</string>
|
||||
<string name="application_name">Nix</string>
|
||||
<string name="shared_user_label">Nix user</string>
|
||||
<string name="app_failsafe_mode">Nix (failsafe shell)</string>
|
||||
<string name="termux_exec_permission_label">Nix:Execute</string>
|
||||
<string name="termux_exec_permission_desc">Allows application to execute arbitrary shell commands within Nix (Termux).</string>
|
||||
<string name="new_session">New session</string>
|
||||
<string name="new_session_failsafe">Failsafe</string>
|
||||
<string name="toggle_soft_keyboard">Keyboard</string>
|
||||
|
|
@ -16,10 +16,10 @@
|
|||
|
||||
<string name="bootstrap_installer_body">Installing…</string>
|
||||
<string name="bootstrap_error_title">Unable to install</string>
|
||||
<string name="bootstrap_error_body">Termux was unable to install the bootstrap packages.\n\nCheck your network connection and try again.</string>
|
||||
<string name="bootstrap_error_body">Nix was unable to install the bootstrap package.</string>
|
||||
<string name="bootstrap_error_abort">Abort</string>
|
||||
<string name="bootstrap_error_try_again">Try again</string>
|
||||
<string name="bootstrap_error_not_primary_user_message">Termux can only be installed on the primary user account.</string>
|
||||
<string name="bootstrap_error_not_primary_user_message">Nix can only be installed on the primary user account.</string>
|
||||
|
||||
<string name="max_terminals_reached_title">Max terminals reached</string>
|
||||
<string name="max_terminals_reached_message">Close down existing ones before creating new.</string>
|
||||
|
|
|
|||
45
shell.nix
Normal file
45
shell.nix
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
{ pkgs ? import <nixpkgs> {} }:
|
||||
|
||||
let fhs = pkgs.buildFHSUserEnv {
|
||||
name = "android-env";
|
||||
targetPkgs = pkgs: with pkgs;
|
||||
[ git
|
||||
gitRepo
|
||||
gnupg
|
||||
python2
|
||||
curl
|
||||
procps
|
||||
openssl
|
||||
gnumake
|
||||
nettools
|
||||
androidenv.platformTools
|
||||
jdk
|
||||
schedtool
|
||||
utillinux
|
||||
m4
|
||||
gperf
|
||||
perl
|
||||
libxml2
|
||||
zip
|
||||
unzip
|
||||
bison
|
||||
flex
|
||||
lzop
|
||||
file
|
||||
gnumake
|
||||
];
|
||||
multiPkgs = pkgs: with pkgs;
|
||||
[ zlib
|
||||
];
|
||||
runScript = "bash";
|
||||
profile = ''
|
||||
export USE_CCACHE=1
|
||||
export ANDROID_JAVA_HOME=${pkgs.jdk.home}
|
||||
export JAVA_HOME=${pkgs.jdk.home}
|
||||
'';
|
||||
};
|
||||
in pkgs.stdenv.mkDerivation {
|
||||
name = "android-env-shell";
|
||||
nativeBuildInputs = [ fhs ];
|
||||
shellHook = "exec android-env";
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ android {
|
|||
}
|
||||
|
||||
ndk {
|
||||
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
|
||||
abiFilters 'arm64-v8a'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue