system-build: Add DTB mapping
{ config, lib, pkgs, ... }:
let
- inherit (lib) mkIf;
+ inherit (lib) mkIf optionalString;
deviceName = config.mobile.device.name;
+
+ dtbMapping = pkgs.runCommandNoCC "dtb-mapping.json" {} ''
+ (
+ PS4=" $ "; set -x
+ ${pkgs.buildPackages.mobile-nixos.map-dtbs}/bin/map-dtbs $(find ${config.hardware.deviceTree.package} -name '*.dtb' | sort) > $out
+ )
+ '';
in
{
config = mkIf (!config.mobile.rootfs.shared.enabled) {
@@ -14,6 +21,9 @@ in
mkdir -p $out/mobile-nixos
cd $out/mobile-nixos
echo "${deviceName}" > device-name
+ ${optionalString (config.hardware.deviceTree.package != null) ''
+ ln -s ${dtbMapping} dtb-mapping.json
+ ''}
)
'';
};
