mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 11:36:07 +01:00
modules/android-integration: add am command
This commit is contained in:
parent
b7e7cd423d
commit
c4c4f09e3d
10 changed files with 175 additions and 0 deletions
33
pkgs/android-integration/termux-am.nix
Normal file
33
pkgs/android-integration/termux-am.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# Copyright (c) 2019-2024, see AUTHORS. Licensed under MIT License, see LICENSE.
|
||||
|
||||
{ stdenv, fetchFromGitHub, cmake }:
|
||||
|
||||
let
|
||||
appPath = "/data/data/com.termux.nix/files/apps/com.termux.nix";
|
||||
socketPath = "${appPath}/termux-am/am.sock";
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
name = "termux-am";
|
||||
version = "1.5.0";
|
||||
src = fetchFromGitHub {
|
||||
owner = "termux";
|
||||
repo = "termux-am-socket";
|
||||
rev = version;
|
||||
sha256 = "sha256-6pCv2HMBRp8Hi56b43mQqnaFaI7y5DfhS9gScANwg2I=";
|
||||
};
|
||||
nativeBuildInputs = [ cmake ];
|
||||
patchPhase = ''
|
||||
# Header generation doesn't seem to work on android
|
||||
echo "#define SOCKET_PATH \"${socketPath}\"" > termux-am.h
|
||||
# Fix the bash link so that nix can patch it + path to termux-am-socket
|
||||
substituteInPlace termux-am.sh.in \
|
||||
--replace @TERMUX_PREFIX@/bin/bash /bin/bash \
|
||||
--replace \
|
||||
"termux-am-socket \"\$am_command_string\"" \
|
||||
"$out/bin/termux-am-socket \"\$am_command_string\""
|
||||
'';
|
||||
postInstall = ''
|
||||
# Scripts use 'am' as an alias.
|
||||
ln -s $out/bin/termux-am $out/bin/am
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue