Skip to content

Commit

Permalink
Enable cross-compiled devicePkgs for flash-script
Browse files Browse the repository at this point in the history
Signed-off-by: Mika Tammi <[email protected]>
  • Loading branch information
Mika Tammi authored and brianmcgillion committed Sep 5, 2023
1 parent fec29af commit a973cab
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/mk-flash-script.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,19 @@
}: let
cfg = hostConfiguration.config.hardware.nvidia-jetpack;
inherit (jetpack-nixos.legacyPackages.${flash-tools-system}) flash-tools;
devicePkgs = jetpack-nixos.legacyPackages.${flash-tools-system}.devicePkgsFromNixosConfig hostConfiguration.config;

# jetpack-nixos has the cross-compilation set up in a slightly strange way,
# the packages under x86_64-linux are actually cross-compiled packages for
# aarch64-linux. So we will get devicePkgs from x86_64-linux if we are cross
# compiling, otherwise we end up building UEFI firmware etc. binaries used by
# flash-script natively.
isCross = hostConfiguration.config.nixpkgs.buildPlatform.system != hostConfiguration.config.nixpkgs.hostPlatform.system;
devicePkgsSystem =
if isCross
then "x86_64-linux"
else "aarch64-linux";
devicePkgs = jetpack-nixos.legacyPackages.${devicePkgsSystem}.devicePkgsFromNixosConfig hostConfiguration.config;

flashScript = devicePkgs.mkFlashScript {
flash-tools = flash-tools.overrideAttrs ({postPatch ? "", ...}: {
postPatch = postPatch + cfg.flashScriptOverrides.postPatch;
Expand Down

0 comments on commit a973cab

Please sign in to comment.