mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 11:36:07 +01:00
33 lines
1 KiB
Nix
33 lines
1 KiB
Nix
# 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
|
|
'';
|
|
}
|