-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
nixos/anbox: use mainline drivers when available #102341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ let | |
|
|
||
| cfg = config.virtualisation.anbox; | ||
| kernelPackages = config.boot.kernelPackages; | ||
| useAnboxModules = kernelPackages.kernelOlder "5.0"; | ||
| addrOpts = v: addr: pref: name: { | ||
| address = mkOption { | ||
| default = addr; | ||
|
|
@@ -73,13 +74,17 @@ in | |
|
|
||
| environment.systemPackages = with pkgs; [ anbox ]; | ||
|
|
||
| boot.kernelModules = [ "ashmem_linux" "binder_linux" ]; | ||
| boot.extraModulePackages = [ kernelPackages.anbox ]; | ||
| # Mainline ashmem/binder drivers not available as modules | ||
| boot.kernelModules = optionals useAnboxModules [ "ashmem_linux" "binder_linux" ]; | ||
| boot.extraModulePackages = optional useAnboxModules kernelPackages.anbox; | ||
|
|
||
| services.udev.extraRules = '' | ||
| KERNEL=="ashmem", NAME="%k", MODE="0666" | ||
| KERNEL=="binder*", NAME="%k", MODE="0666" | ||
| ''; | ||
| systemd.mounts = optional (!useAnboxModules) { | ||
| 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 = []; | ||
|
|
@@ -129,7 +134,8 @@ in | |
| --container-network-gateway=${cfg.ipv4.gateway.address} \ | ||
| --container-network-dns-servers=${cfg.ipv4.dns} \ | ||
| --use-rootfs-overlay \ | ||
| --privileged | ||
| --privileged \ | ||
| --daemon | ||
|
||
| ''; | ||
| }; | ||
| }; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import ./make-test-python.nix ({ pkgs, ... }: | ||
|
|
||
| { | ||
| name = "anbox"; | ||
| meta = with pkgs.stdenv.lib.maintainers; { | ||
| maintainers = [ mvnetbiz ]; | ||
| }; | ||
|
|
||
| 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; | ||
| virtualisation.memorySize = 2500; | ||
| }; | ||
|
|
||
| testScript = { nodes, ... }: let | ||
| user = nodes.machine.config.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")) | ||
| ''; | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this stay but put behind a conditional for
useAnboxModules?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can tell these rules don't do anything anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't recall but they either don't run or anbox works correctly with the default mode anyways.