Skip to content

Commit

Permalink
fix compileDTS overlay
Browse files Browse the repository at this point in the history
due to NixOS/nixpkgs#251898
the compileDTS function has been moved to `device-tree`

nixos-hardware has an own overlay for the raspberry-pi
which needs the `compileDTS` function now, too.

This commit adds it.

Signed-off-by: Florian Brandes <[email protected]>
  • Loading branch information
gador committed Oct 8, 2023
1 parent bb2db41 commit 0a7b7f1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
29 changes: 29 additions & 0 deletions raspberry-pi/4/compile-overlays-dtmerge.nix
Original file line number Diff line number Diff line change
@@ -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
'';
})



1 change: 1 addition & 0 deletions raspberry-pi/4/pkgs-overlays.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 0a7b7f1

Please sign in to comment.