mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2025-01-08 12:48:50 +03:00
1754276528
*sighs*
31 lines
834 B
Nix
31 lines
834 B
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
inherit (lib) mkIf optionalString;
|
|
|
|
deviceName = config.mobile.device.name;
|
|
|
|
dtbMapping = pkgs.runCommand "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.enable && !config.mobile.rootfs.shared.enabled) {
|
|
system.extraSystemBuilderCmds = ''
|
|
echo ":: Adding Mobile NixOS information to the build..."
|
|
(
|
|
PS4=" $ "; set -x
|
|
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
|
|
''}
|
|
)
|
|
'';
|
|
};
|
|
}
|