it-infra/nixops/device-tree-pkg.nix
Sebastien Bourdeauducq 8924e769f0 nixops: work around devicetree breakage in nixpkgs
This reverts the effects of nixpkgs commit 6c9df40a4bc819fcab0836ad28ee944c8ce66db0
and restores the old behavior.
2021-06-03 07:17:55 +08:00

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
'';
});
}