1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-18 05:21:47 +03:00
mobile-nixos/modules/stage-0.nix

39 lines
1.1 KiB
Nix
Raw Normal View History

{ config, lib, pkgs, modules, baseModules, ... }:
# This module provides the `stage-0` build output.
# It is the same configuration, with minor customizations.
let
inherit (lib) mkOption types;
inherit (config.mobile.quirks) supportsStage-0;
kernelVersionSupportsKexec =
if pkgs.targetPlatform.system == "aarch64-linux"
then (lib.versionAtLeast (config.mobile.boot.stage-1.kernel.package.version) "4.8")
else true
;
in
{
options = {
mobile.quirks.supportsStage-0 = mkOption {
type = types.bool;
default = kernelVersionSupportsKexec;
defaultText = "(Varies per platform; aarch64 depends on kernel version.)";
description = ''
Set to false when a device cannot use `kexec` to kexec into a system.
A default value will be selected according to the platform and
`mobile.boot` kernel selected.
'';
};
};
config = {
system.build.stage-0 = (import ../lib/eval-config.nix {
inherit baseModules;
modules = modules ++ [{
mobile.boot.stage-1.stage = if supportsStage-0 then 0 else 1;
}];
}).config;
};
}