Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Cross compilation

Overriding build systems

When cross compiling build systems needs to be overriden twice. Once for the build host and once for the target host

let
  pyprojectOverrides = final: prev: {
    hatchling = prev.hatchling.overrideAttrs (old: {
      nativeBuildInputs =
        old.nativeBuildInputs
        ++ final.resolveBuildSystem {
          pathspec = [ ];
        };
    });
  };

in
pythonSet.overrideScope (
  lib.composeExtensions (_final: prev: {
    pythonPkgsBuildHost = prev.pythonPkgsBuildHost.overrideScope pyprojectOverrides;
  }) pyprojectOverrides
)

Adding native build dependencies

final: prev: {

  foobar = prev.foobar.overrideAttrs (old: {
    nativeBuildInputs = old.nativeBuildInputs ++ [
      final.pkgs.buildPackages.cmake
    ];

    buildInputs = (old.buildInputs or [ ]) ++ [ final.pkgs.ncurses ];
  });

}