1{
2 stdenv,
3 fetchFromGitLab,
4 ffmpeg,
5 meson,
6 openjdk17,
7 lib,
8 glib,
9 pkg-config,
10 wayland-protocols,
11 wayland,
12 wayland-scanner,
13 gtk4,
14 openxr-loader,
15 libglvnd,
16 libportal-gtk4,
17 sqlite,
18 libdrm,
19 libgudev,
20 webkitgtk_6_0,
21 ninja,
22 art-standalone,
23 bionic-translation,
24 alsa-lib,
25 makeWrapper,
26 replaceVars,
27 nixosTests,
28}:
29
30stdenv.mkDerivation {
31 pname = "android-translation-layer";
32 version = "0-unstable-2025-07-14";
33
34 src = fetchFromGitLab {
35 owner = "android_translation_layer";
36 repo = "android_translation_layer";
37 rev = "828f779c4f7170f608047c500d6d3b64b480df7f";
38 hash = "sha256-1KYZWlzES3tbskqvA8qSQCegE0uLTLCq4q2CX6uix4o=";
39 };
40
41 patches = [
42 (replaceVars ./configure-art-path.patch {
43 artStandalonePackageDir = "${art-standalone}";
44 })
45
46 # Required gio-unix dependency is missing in meson.build
47 ./add-gio-unix-dep.patch
48
49 # Patch custon Dex install dir
50 ./configure-dex-install-dir.patch
51 ];
52
53 postPatch = ''
54 # As we need the $out reference, we can't use `replaceVars` here.
55 substituteInPlace src/main-executable/main.c \
56 --replace-fail '@out@' "$out"
57 '';
58
59 nativeBuildInputs = [
60 makeWrapper
61 meson
62 ninja
63 openjdk17
64 pkg-config
65 ];
66
67 buildInputs = [
68 alsa-lib
69 art-standalone
70 bionic-translation
71 ffmpeg
72 gtk4
73 libdrm
74 libglvnd
75 libgudev
76 libportal-gtk4
77 openxr-loader
78 sqlite
79 wayland
80 wayland-protocols
81 wayland-scanner
82 webkitgtk_6_0
83 ];
84
85 postFixup = ''
86 wrapProgram $out/bin/android-translation-layer \
87 --prefix LD_LIBRARY_PATH : ${art-standalone}/lib/art
88 '';
89
90 passthru.tests = {
91 inherit (nixosTests) android-translation-layer;
92 };
93
94 meta = {
95 description = "Translation layer that allows running Android apps on a Linux system";
96 homepage = "https://gitlab.com/android_translation_layer/android_translation_layer";
97 license = lib.licenses.gpl3Plus;
98 platforms = lib.platforms.all;
99 maintainers = with lib.maintainers; [ onny ];
100 mainProgram = "android-translation-layer";
101 };
102}