8ac5e011d6
GitOrigin-RevId: 2c3273caa153ee8eb5786bc8141b85b859e7efd7
17 lines
556 B
Nix
17 lines
556 B
Nix
{ stdenvNoCC, dtc, findutils }:
|
|
|
|
with stdenvNoCC.lib; {
|
|
applyOverlays = (base: overlays: stdenvNoCC.mkDerivation {
|
|
name = "device-tree-overlays";
|
|
nativeBuildInputs = [ dtc findutils ];
|
|
buildCommand = let
|
|
quotedDtbos = concatMapStringsSep " " (o: "\"${toString o}\"") (toList overlays);
|
|
in ''
|
|
for dtb in $(find ${base} -name "*.dtb" ); do
|
|
outDtb=$out/$(realpath --relative-to "${base}" "$dtb")
|
|
mkdir -p "$(dirname "$outDtb")"
|
|
fdtoverlay -o "$outDtb" -i "$dtb" ${quotedDtbos};
|
|
done
|
|
'';
|
|
});
|
|
}
|