nixos/waydroid: remove with lib; and friends

This commit is contained in:
Mihai-Drosi Câju 2023-09-24 16:00:07 +03:00 committed by Emery Hemingway
parent 14c62b156a
commit be6ac65b52

View file

@ -1,10 +1,8 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib;
let let
cfg = config.virtualisation.waydroid; cfg = config.virtualisation.waydroid;
kCfg = config.lib.kernelConfig;
kernelPackages = config.boot.kernelPackages; kernelPackages = config.boot.kernelPackages;
waydroidGbinderConf = pkgs.writeText "waydroid.conf" '' waydroidGbinderConf = pkgs.writeText "waydroid.conf" ''
[Protocol] [Protocol]
@ -22,19 +20,19 @@ in
{ {
options.virtualisation.waydroid = { options.virtualisation.waydroid = {
enable = mkEnableOption (lib.mdDoc "Waydroid"); enable = lib.mkEnableOption (lib.mdDoc "Waydroid");
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = singleton { assertions = lib.singleton {
assertion = versionAtLeast (getVersion config.boot.kernelPackages.kernel) "4.18"; assertion = lib.versionAtLeast (lib.getVersion config.boot.kernelPackages.kernel) "4.18";
message = "Waydroid needs user namespace support to work properly"; message = "Waydroid needs user namespace support to work properly";
}; };
system.requiredKernelConfig = with config.lib.kernelConfig; [ system.requiredKernelConfig = [
(isEnabled "ANDROID_BINDER_IPC") (kCfg.isEnabled "ANDROID_BINDER_IPC")
(isEnabled "ANDROID_BINDERFS") (kCfg.isEnabled "ANDROID_BINDERFS")
(isEnabled "ASHMEM") # FIXME Needs memfd support instead on Linux 5.18 and waydroid 1.2.1 (kCfg.isEnabled "ASHMEM") # FIXME Needs memfd support instead on Linux 5.18 and waydroid 1.2.1
]; ];
/* NOTE: we always enable this flag even if CONFIG_PSI_DEFAULT_DISABLED is not on /* NOTE: we always enable this flag even if CONFIG_PSI_DEFAULT_DISABLED is not on