diff --git a/raspberry-pi/4/compile-overlays-dtmerge.nix b/raspberry-pi/4/compile-overlays-dtmerge.nix new file mode 100644 index 000000000..7c69c8cff --- /dev/null +++ b/raspberry-pi/4/compile-overlays-dtmerge.nix @@ -0,0 +1,29 @@ +# added this seperate compileDTS due to a change in nixpkgs which seperated `compileDTS` +# see https://github.com/NixOS/nixpkgs/pull/251898 +{ lib, stdenv, stdenvNoCC, dtc, libraspberrypi }: + +with lib; +# Compile single Device Tree overlay source +# file (.dts) into its compiled variant (.dtb) +({ name + , dtsFile + , includePaths ? [ ] + , extraPreprocessorFlags ? [ ] + }: stdenv.mkDerivation { + inherit name; + + nativeBuildInputs = [ dtc ]; + + buildCommand = + let + includeFlagsStr = lib.concatMapStringsSep " " (includePath: "-I${includePath}") includePaths; + extraPreprocessorFlagsStr = lib.concatStringsSep " " extraPreprocessorFlags; + in + '' + $CC -E -nostdinc ${includeFlagsStr} -undef -D__DTS__ -x assembler-with-cpp ${extraPreprocessorFlagsStr} ${dtsFile} | \ + dtc -I dts -O dtb -@ -o $out + ''; +}) + + + diff --git a/raspberry-pi/4/pkgs-overlays.nix b/raspberry-pi/4/pkgs-overlays.nix index cc639d46f..e1b56aa6d 100644 --- a/raspberry-pi/4/pkgs-overlays.nix +++ b/raspberry-pi/4/pkgs-overlays.nix @@ -3,6 +3,7 @@ let cfg = config.hardware.raspberry-pi."4".apply-overlays-dtmerge; dt_ao_overlay = _final: prev: { deviceTree.applyOverlays = prev.callPackage ./apply-overlays-dtmerge.nix { }; + deviceTree.compileDTS = prev.callPackage ./compile-overlays-dtmerge.nix { }; }; in { options.hardware = {