mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-11-06 18:26:45 +01:00
28cf80acf8
In response to comments, create a sub-folder for deviceTree packages (starting with rpi), and a top-level package for helpers.
18 lines
556 B
Nix
18 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
|
|
'';
|
|
});
|
|
}
|