anbox: drop

Upstream project is not maintained anymore and the package
currently does not build.

https://github.com/anbox/.github/blob/main/profile/README.md
This commit is contained in:
Thomas Gerbet
2025-01-04 11:56:17 +01:00
parent 450382bdd4
commit 9330230e47
11 changed files with 5 additions and 495 deletions

View File

@@ -1750,7 +1750,6 @@
./tasks/trackpoint.nix
./testing/service-runner.nix
./virtualisation/amazon-options.nix
./virtualisation/anbox.nix
./virtualisation/appvm.nix
./virtualisation/build-vm.nix
./virtualisation/container-config.nix

View File

@@ -78,6 +78,10 @@ in
(mkRemovedOptionModule [ "services" "antennas" ]
"The antennas package and the corresponding module have been removed as they only work with tvheadend, which nobody was willing to maintain and was stuck on an unmaintained version that required FFmpeg 4; please see https://github.com/NixOS/nixpkgs/pull/332259 if you are interested in maintaining a newer version."
)
(mkRemovedOptionModule [
"services"
"anbox"
] "The corresponding package was removed from nixpkgs as it is not maintained upstream anymore.")
(mkRemovedOptionModule [
"services"
"ankisyncd"

View File

@@ -1,194 +0,0 @@
{
config,
lib,
pkgs,
...
}:
with lib;
let
cfg = config.virtualisation.anbox;
addrOpts = v: addr: pref: name: {
address = mkOption {
default = addr;
type = types.str;
description = ''
IPv${toString v} ${name} address.
'';
};
prefixLength = mkOption {
default = pref;
type = types.addCheck types.int (n: n >= 0 && n <= (if v == 4 then 32 else 128));
description = ''
Subnet mask of the ${name} address, specified as the number of
bits in the prefix (`${if v == 4 then "24" else "64"}`).
'';
};
};
finalImage =
if cfg.imageModifications == "" then
cfg.image
else
(pkgs.callPackage (
{ runCommandNoCC, squashfsTools }:
runCommandNoCC "${cfg.image.name}-modified.img"
{
nativeBuildInputs = [
squashfsTools
];
}
''
echo "-> Extracting Anbox root image..."
unsquashfs -dest rootfs ${cfg.image}
echo "-> Modifying Anbox root image..."
(
cd rootfs
${cfg.imageModifications}
)
echo "-> Packing modified Anbox root image..."
mksquashfs rootfs $out -comp xz -no-xattrs -all-root
''
) { });
in
{
options.virtualisation.anbox = {
enable = mkEnableOption "Anbox";
image = mkOption {
default = pkgs.anbox.image;
defaultText = literalExpression "pkgs.anbox.image";
type = types.package;
description = ''
Base android image for Anbox.
'';
};
imageModifications = mkOption {
default = "";
type = types.lines;
description = ''
Commands to edit the image filesystem.
This can be used to e.g. bundle a privileged F-Droid.
Commands are ran with PWD being at the root of the filesystem.
'';
};
extraInit = mkOption {
type = types.lines;
default = "";
description = ''
Extra shell commands to be run inside the container image during init.
'';
};
ipv4 = {
container = addrOpts 4 "192.168.250.2" 24 "Container";
gateway = addrOpts 4 "192.168.250.1" 24 "Host";
dns = mkOption {
default = "1.1.1.1";
type = types.str;
description = ''
Container DNS server.
'';
};
};
};
config = mkIf cfg.enable {
assertions = singleton {
assertion = with config.boot.kernelPackages; kernelAtLeast "5.5" && kernelOlder "5.18";
message = "Anbox needs a kernel with binder and ashmem support";
};
environment.systemPackages = with pkgs; [ anbox ];
systemd.mounts = singleton {
requiredBy = [ "anbox-container-manager.service" ];
description = "Anbox Binder File System";
what = "binder";
where = "/dev/binderfs";
type = "binder";
};
virtualisation.lxc.enable = true;
networking.bridges.anbox0.interfaces = [ ];
networking.interfaces.anbox0.ipv4.addresses = [ cfg.ipv4.gateway ];
networking.nat = {
enable = true;
internalInterfaces = [ "anbox0" ];
};
# Ensures NetworkManager doesn't touch anbox0
networking.networkmanager.unmanaged = [ "anbox0" ];
systemd.services.anbox-container-manager =
let
anboxloc = "/var/lib/anbox";
in
{
description = "Anbox Container Management Daemon";
environment.XDG_RUNTIME_DIR = "${anboxloc}";
wantedBy = [ "multi-user.target" ];
preStart =
let
initsh = pkgs.writeText "nixos-init" (
''
#!/system/bin/sh
setprop nixos.version ${config.system.nixos.version}
# we don't have radio
setprop ro.radio.noril yes
stop ril-daemon
# speed up boot
setprop debug.sf.nobootanimation 1
''
+ cfg.extraInit
);
initshloc = "${anboxloc}/rootfs-overlay/system/etc/init.goldfish.sh";
in
''
mkdir -p ${anboxloc}
mkdir -p $(dirname ${initshloc})
[ -f ${initshloc} ] && rm ${initshloc}
cp ${initsh} ${initshloc}
chown 100000:100000 ${initshloc}
chmod +x ${initshloc}
'';
serviceConfig = {
ExecStart = ''
${pkgs.anbox}/bin/anbox container-manager \
--data-path=${anboxloc} \
--android-image=${finalImage} \
--container-network-address=${cfg.ipv4.container.address} \
--container-network-gateway=${cfg.ipv4.gateway.address} \
--container-network-dns-servers=${cfg.ipv4.dns} \
--use-rootfs-overlay \
--privileged \
--daemon
'';
};
};
};
}

View File

@@ -124,7 +124,6 @@ in {
amazon-init-shell = handleTest ./amazon-init-shell.nix {};
amazon-ssm-agent = handleTest ./amazon-ssm-agent.nix {};
amd-sev = runTest ./amd-sev.nix;
anbox = runTest ./anbox.nix;
angie-api = handleTest ./angie-api.nix {};
anki-sync-server = handleTest ./anki-sync-server.nix {};
anuko-time-tracker = handleTest ./anuko-time-tracker.nix {};

View File

@@ -1,41 +0,0 @@
{ lib, pkgs, ... }:
{
name = "anbox";
meta.maintainers = with lib.maintainers; [ mvnetbiz ];
nodes.machine =
{ pkgs, config, ... }:
{
imports = [
./common/user-account.nix
./common/x11.nix
];
environment.systemPackages = with pkgs; [ android-tools ];
test-support.displayManager.auto.user = "alice";
virtualisation.anbox.enable = true;
boot.kernelPackages = pkgs.linuxKernel.packages.linux_5_15;
virtualisation.memorySize = 2500;
};
testScript =
{ nodes, ... }:
let
user = nodes.machine.users.users.alice;
bus = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${toString user.uid}/bus";
in
''
machine.wait_for_x()
machine.wait_until_succeeds(
"sudo -iu alice ${bus} anbox wait-ready"
)
machine.wait_until_succeeds("adb shell true")
print(machine.succeed("adb devices"))
'';
}

View File

@@ -1,34 +0,0 @@
From cb61e856c4357d9787f7a2313bacb1c3b2133d36 Mon Sep 17 00:00:00 2001
From: Samuel Dionne-Riel <samuel@dionne-riel.com>
Date: Fri, 4 Jun 2021 19:05:53 -0400
Subject: [PATCH] [NixOS] Use `anbox` from PATH in desktop files
---
src/anbox/application/launcher_storage.cpp | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/anbox/application/launcher_storage.cpp b/src/anbox/application/launcher_storage.cpp
index d5053cf..a4be719 100644
--- a/src/anbox/application/launcher_storage.cpp
+++ b/src/anbox/application/launcher_storage.cpp
@@ -69,9 +69,7 @@ void LauncherStorage::add_or_update(const Database::Item &item) {
auto package_name = item.package;
std::replace(package_name.begin(), package_name.end(), '.', '-');
- auto exe_path = utils::process_get_exe_path(getpid());
- if (utils::get_env_value("SNAP").length() > 0)
- exe_path = snap_exe_path;
+ auto exe_path = "anbox";
std::string exec = utils::string_format("%s launch ", exe_path);
@@ -121,4 +119,4 @@ void LauncherStorage::remove(const Database::Item &item) {
fs::remove(item_icon_path);
}
-}
\ No newline at end of file
+}
--
2.29.2

View File

@@ -1,11 +0,0 @@
--- a/external/android-emugl/CMakeLists.txt
+++ b/external/android-emugl/CMakeLists.txt
@@ -1,7 +1,7 @@
# Don't treat any warnings as error as we take the source directly from
# upstream and just compile it.
set(CMAKE_C_FLAGS "-Wall")
-set(CMAKE_CXX_FLAGS "-std=c++11 -Wall")
+set(CMAKE_CXX_FLAGS "-std=c++14 -Wall")
# Ensure -fPIC
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

View File

@@ -1,189 +0,0 @@
{
lib,
stdenv,
fetchFromGitHub,
callPackage,
fetchpatch,
cmake,
pkg-config,
dbus,
makeWrapper,
boost,
elfutils, # for libdw
git,
glib,
glm,
gtest,
libbfd,
libcap,
libdwarf,
libGL,
libglvnd,
lxc,
libgbm,
properties-cpp,
protobuf,
protobufc,
python3,
runtimeShell,
SDL2,
SDL2_image,
systemd,
writeText,
writeShellScript,
nixosTests,
}:
let
dbus-service = writeText "org.anbox.service" ''
[D-BUS Service]
Name=org.anbox
Exec=@out@/libexec/anbox-session-manager
'';
anbox-application-manager = writeShellScript "anbox-application-manager" ''
exec @out@/bin/anbox launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity
'';
in
stdenv.mkDerivation rec {
pname = "anbox";
version = "unstable-2023-02-03";
src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = "ddf4c57ebbe3a2e46099087570898ab5c1e1f279";
hash = "sha256-QXWhatewiUDQ93cH1UZsYgbjUxpgB1ajtGFYZnKmabc=";
fetchSubmodules = true;
};
nativeBuildInputs = [
cmake
pkg-config
makeWrapper
protobufc
];
buildInputs = [
boost
dbus
elfutils # libdw
glib
glm
gtest
libbfd
libcap
libdwarf
libGL
lxc
libgbm
properties-cpp
protobuf
python3
SDL2
SDL2_image
systemd
];
env.CXXFLAGS = toString [ "-include cstdint" ];
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isGNU (toString [
"-Wno-error=redundant-move"
# Flag needed by GCC 12 but unrecognized by GCC 9 (aarch64-linux default now)
(lib.optionalString (lib.versionAtLeast stdenv.cc.version "12") "-Wno-error=mismatched-new-delete")
]);
prePatch = ''
patchShebangs scripts
cat >cmake/FindGMock.cmake <<'EOF'
add_library(gtest INTERFACE)
target_include_directories(gtest INTERFACE ${gtest.dev}/include)
target_link_libraries(gtest INTERFACE ${gtest}/lib/libgtest.so ''${CMAKE_THREAD_LIBS_INIT})
add_dependencies(gtest GMock)
add_library(gtest_main INTERFACE)
target_include_directories(gtest_main INTERFACE ${gtest.dev}/include)
target_link_libraries(gtest_main INTERFACE ${gtest}/lib/libgtest_main.so gtest)
add_library(gmock INTERFACE)
target_include_directories(gmock INTERFACE ${gtest.dev}/include)
target_link_libraries(gmock INTERFACE ${gtest}/lib/libgmock.so gtest)
add_library(gmock_main INTERFACE)
target_include_directories(gmock_main INTERFACE ${gtest.dev}/include)
target_link_libraries(gmock_main INTERFACE ${gtest}/lib/libgmock_main.so gmock gtest_main)
set(GTEST_LIBRARIES gtest)
set(GTEST_MAIN_LIBRARIES gtest_main)
set(GMOCK_LIBRARIES gmock gmock_main)
set(GTEST_BOTH_LIBRARIES ''${GTEST_LIBRARIES} ''${GTEST_MAIN_LIBRARIES})
EOF
'';
patches = [
# Fixes compatibility with lxc 4
(fetchpatch {
url = "https://git.alpinelinux.org/aports/plain/community/anbox/lxc4.patch?id=64243590a16aee8d4e72061886fc1b15256492c3";
sha256 = "1da5xyzyjza1g2q9nbxb4p3njj2sf3q71vkpvmmdphia5qnb0gk5";
})
# Wait 10× more time when starting
# Not *strictly* needed, but helps a lot on slower hardware
(fetchpatch {
url = "https://git.alpinelinux.org/aports/plain/community/anbox/give-more-time-to-start.patch?id=058b56d4b332ef3379551b343bf31e0f2004321a";
sha256 = "0iiz3c7fgfgl0dvx8sf5hv7a961xqnihwpz6j8r0ib9v8piwxh9a";
})
# Ensures generated desktop files work on store path change
./0001-NixOS-Use-anbox-from-PATH-in-desktop-files.patch
# Allows android-emugl to build with gtest 1.13+
./0002-NixOS-Build-android-emugl-with-cpp-14.patch
# Provide window icons
(fetchpatch {
url = "https://github.com/samueldr/anbox/commit/2387f4fcffc0e19e52e58fb6f8264fbe87aafe4d.patch";
sha256 = "12lmr0kxw1n68g3abh1ak5awmpczfh75c26f53jc8qpvdvv1ywha";
})
];
postInstall = ''
wrapProgram $out/bin/anbox \
--set SDL_VIDEO_X11_WMCLASS "anbox" \
--prefix LD_LIBRARY_PATH : ${
lib.makeLibraryPath [
libGL
libglvnd
]
} \
--prefix PATH : ${git}/bin
mkdir -p $out/share/dbus-1/services
substitute ${dbus-service} $out/share/dbus-1/services/org.anbox.service \
--subst-var out
mkdir $out/libexec
makeWrapper $out/bin/anbox $out/libexec/anbox-session-manager \
--add-flags session-manager
substitute ${anbox-application-manager} $out/bin/anbox-application-manager \
--subst-var out
chmod +x $out/bin/anbox-application-manager
'';
passthru.tests = { inherit (nixosTests) anbox; };
passthru.image = callPackage ./postmarketos-image.nix { };
meta = with lib; {
homepage = "https://anbox.io";
description = "Android in a box";
license = licenses.gpl2Only;
maintainers = with maintainers; [ edwtjo ];
platforms = [
"armv7l-linux"
"aarch64-linux"
"x86_64-linux"
];
};
}

View File

@@ -1,20 +0,0 @@
{ stdenv, fetchurl }:
let
imgroot = "https://web.archive.org/web/20211027150924/https://anbox.postmarketos.org";
in
{
armv7l-linux = fetchurl {
url = imgroot + "/android-7.1.2_r39.1-anbox_armv7a_neon-userdebug.img";
sha256 = "1bgzqw4yp52a2q40dr1jlay1nh73jl5mx6wqsxvpb09xghxsng0a";
};
aarch64-linux = fetchurl {
url = imgroot + "/android-7.1.2_r39-anbox_arm64-userdebug.img";
sha256 = "0dx8mhfcjbkak982zfh65bvy35slz5jk31yl4ara50ryrxsp32nx";
};
x86_64-linux = fetchurl {
url = imgroot + "/android-7.1.2_r39-anbox_x86_64-userdebug.img";
sha256 = "16vmiz5al2r19wjpd44nagvz7d901ljxdms8gjp2w4xz1d91vzpm";
};
}
.${stdenv.system} or (throw "Unsupported platform ${stdenv.system}")

View File

@@ -110,6 +110,7 @@ mapAliases {
ankisyncd = throw "ankisyncd is dead, use anki-sync-server instead"; # Added 2024-08-10
ao = libfive; # Added 2024-10-11
apacheKafka_3_5 = throw "apacheKafka_2_8 through _3_5 have been removed from nixpkgs as outdated"; # Added 2024-06-13
anbox = throw "'anbox' has been removed as the upstream project is unmaintained, see https://github.com/anbox/.github/blob/main/profile/README.md"; # Added 2025-01-04
antimicroX = throw "'antimicroX' has been renamed to/replaced by 'antimicrox'"; # Converted to throw 2024-10-17
apacheAnt = ant; # Added 2024-11-28
apple-sdk_10_12 = throw "apple-sdk_10_12 was removed as Nixpkgs no longer supports macOS 10.12; see the 25.05 release notes"; # Added 2024-10-27

View File

@@ -1908,10 +1908,6 @@ with pkgs;
inherit (androidenv.androidPkgs) platform-tools;
};
anbox = callPackage ../os-specific/linux/anbox {
protobuf = protobuf_21;
};
androidenv = callPackage ../development/mobile/androidenv { };
androidndkPkgs = androidndkPkgs_26;