2019-09-22 05:42:26 +03:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
device_config = config.mobile.device;
|
2019-09-22 06:21:12 +03:00
|
|
|
device_name = device_config.name;
|
2019-09-22 05:42:26 +03:00
|
|
|
enabled = config.mobile.system.type == "android";
|
|
|
|
|
2019-09-22 06:21:12 +03:00
|
|
|
inherit (config.system.build) rootfs;
|
|
|
|
|
2019-09-22 05:42:26 +03:00
|
|
|
android-bootimg = pkgs.callPackage ../../systems/bootimg.nix {
|
|
|
|
inherit device_config;
|
|
|
|
initrd = config.system.build.initrd;
|
|
|
|
};
|
|
|
|
|
2019-09-22 06:21:12 +03:00
|
|
|
android-device = pkgs.runCommandNoCC "android-device-${device_name}" {} ''
|
|
|
|
mkdir -p $out
|
|
|
|
ln -s ${rootfs}/${rootfs.filename} $out/system.img
|
|
|
|
ln -s ${android-bootimg} $out/boot.img
|
|
|
|
'';
|
2019-09-22 05:42:26 +03:00
|
|
|
in
|
|
|
|
{
|
|
|
|
config = lib.mkMerge [
|
|
|
|
{ mobile.system.types = [ "android" ]; }
|
|
|
|
|
|
|
|
(lib.mkIf enabled {
|
|
|
|
system.build = {
|
|
|
|
inherit android-bootimg android-device;
|
|
|
|
mobile-installer = throw "No installer yet...";
|
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
|
|
|
}
|