nixos/anbox: handle new kernel configurations

This commit is contained in:
Samuel Dionne-Riel 2021-06-03 21:59:08 -04:00 committed by rnhmjoj
parent 708e1eb8ba
commit cdc51c811a
No known key found for this signature in database
GPG key ID: BFBAF4C975F76450

View file

@ -5,7 +5,7 @@ with lib;
let let
cfg = config.virtualisation.anbox; cfg = config.virtualisation.anbox;
kernelPackages = config.boot.kernelPackages;
addrOpts = v: addr: pref: name: { addrOpts = v: addr: pref: name: {
address = mkOption { address = mkOption {
default = addr; default = addr;
@ -67,16 +67,19 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
assertions = singleton { assertions = singleton {
assertion = versionAtLeast (getVersion config.boot.kernelPackages.kernel) "4.18"; assertion = with config.boot.kernelPackages; kernelAtLeast "5.5" && kernelOlder "5.18";
message = "Anbox needs user namespace support to work properly"; message = "Anbox needs a kernel with binder and ashmem support";
}; };
environment.systemPackages = with pkgs; [ anbox ]; environment.systemPackages = with pkgs; [ anbox ];
services.udev.extraRules = '' systemd.mounts = singleton {
KERNEL=="ashmem", NAME="%k", MODE="0666" requiredBy = [ "anbox-container-manager.service" ];
KERNEL=="binder*", NAME="%k", MODE="0666" description = "Anbox Binder File System";
''; what = "binder";
where = "/dev/binderfs";
type = "binder";
};
virtualisation.lxc.enable = true; virtualisation.lxc.enable = true;
networking.bridges.anbox0.interfaces = []; networking.bridges.anbox0.interfaces = [];