mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-12-15 19:23:01 +03:00
31 lines
814 B
Nix
31 lines
814 B
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
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) {
|
|
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
|
|
''}
|
|
)
|
|
'';
|
|
};
|
|
}
|