modules/hardware-soc: Use `generic-*` config when Mobile NixOS config is disabled
This is used to facilitate inclusion of the Mobile NixOS machinery in a
NixOS config, but opting-in into only a few components (e.g. stage-1)
{ config, lib, pkgs, ... }:
let
- inherit (lib) mkOption types;
+ inherit (lib) mkIf mkOption mkOptionDefault types;
cfg = config.mobile.hardware;
in
{
@@ -20,5 +20,14 @@ in
{ assertion = cfg.socs ? ${cfg.soc}; message = "Cannot enable SOC ${cfg.soc}; it is unknown.";}
];
mobile.hardware.socs."${cfg.soc}".enable = true;
+
+ # When evaluating with the Mobile NixOS defaults disabled, we want
+ # to use the a generic type so evaluation can continue.
+ # Otherwise we want to error on an unset value if not set.
+ mobile.hardware.soc = mkIf (!config.mobile.enable) (
+ mkOptionDefault (
+ "generic-${config.nixpkgs.localSystem.parsed.cpu.name}"
+ )
+ );
};
}
