1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-11-28 12:56:54 +03:00

Adds mobile.system.platform

This commit is contained in:
Samuel Dionne-Riel 2018-06-26 21:52:09 -04:00
parent cf47617e62
commit 04a59a0aed
4 changed files with 41 additions and 0 deletions

View File

@ -18,6 +18,8 @@
fb_modes = ./fb.modes;
};
};
mobile.system.platform = "aarch64-linux";
mobile.system.type = "android-bootimg";
mobile.boot.stage-1 = {
extraUtils = with pkgs; [

View File

@ -60,6 +60,8 @@ in
};
ram = 512;
};
mobile.system.platform = "x86_64-linux";
mobile.system.type = "kernel-initrd";
mobile.boot.stage-1 = {
redirect-log.targets = lib.mkIf (splash != true) [ "/dev/tty0" ];

View File

@ -29,5 +29,6 @@ in
./nixpkgs.nix
./quirks-qualcomm.nix
./system-build.nix
./system-target.nix
./system-types.nix
]

36
modules/system-target.nix Normal file
View File

@ -0,0 +1,36 @@
{ config, lib, pkgs, ... }:
# FIXME : current implementation only works for native x86_64 built hosts.
with lib;
let
cfg = config.mobile.system;
target_types = {
aarch64-linux = lib.systems.examples.aarch64-multiplatform;
x86_64-linux = null; # TODO : cross-compile from ARM and others!
};
in
{
options.mobile = {
system.platform = mkOption {
type = types.enum (lib.attrNames target_types);
description = ''
Defines the kind of target architecture system the device is.
This will automagically setup cross-compilation where possible.
'';
};
};
config = {
assertions = [
{
assertion = pkgs.targetPlatform.system == cfg.platform;
message = "pkgs.targetPlatform.system expected to be `aarch64-linux`, is `${pkgs.targetPlatform.system}`";
}
];
nixpkgs.crossSystem = target_types.${cfg.platform};
};
}