Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
54a1ef1
flash-from-device: Add patches to compile mtdutils with musl
elliotberman Jun 25, 2025
b67b01e
flash-from-device: Add missing fields from flash.idx
elliotberman Jun 25, 2025
20bc50f
s/buildFHSUserEnv/buildFHSEnv/
elliotberman May 19, 2025
e1b355b
Merge pull request #289 from elliotberman/refactor-for-jetpack6
danielfullmer Jun 26, 2025
f5a1bb7
nvidia-container-toolkit: Migrate hardware.nvidia-jetpack.container-t…
elliotberman Jun 27, 2025
9fc9edb
Add jetpack 6.2 source versions
elliotberman May 5, 2025
711fd12
jetpack 6: Check valid SoC family
elliotberman May 6, 2025
a4d3823
Add l4t r36.4.3 kernel derivation
elliotberman May 5, 2025
925ccda
uefi-firmware: Introduce r36.4.3 uefi build
elliotberman May 5, 2025
6c40cc6
cuda-packages: Build vpi2 for jetpack 5, vpi3 for jetpack 6
elliotberman May 5, 2025
16a8e7c
Update removal paths for l4t-tools in jetpack 6
elliotberman May 5, 2025
4b94076
kernel: build out-of-tree devicetree and modules in jetpack 6
elliotberman Jun 27, 2025
7fc015e
optee: Enable PAC/BTI in L4T r35 for t234 socs
elliotberman May 6, 2025
541cb7d
Update patch for flash-tools
elliotberman May 6, 2025
7dbc8e0
l4t: move flatten lib/nvidia/
elliotberman May 6, 2025
7aa1b26
l4t: l4t-3d-core: Make libnvidia-vulkan-producer.so optional
elliotberman May 6, 2025
3f89065
l4t: l4t-cuda: libnvidia-ptxjitcompiler.so uses cuda driver version
elliotberman May 6, 2025
7767a25
modules: Handle renamed partitionTemplate directory
elliotberman May 6, 2025
bcf98ff
modules: Disable usb-otg only in 5.15 orin-nx
elliotberman May 6, 2025
b4f4d23
l4t.csv: Install multiple files
elliotberman May 6, 2025
86e13ce
bup: Sign bup in jetpack 6
elliotberman May 6, 2025
7ce47fb
samples: cupti-samples: Enable compilation of cupti-samples in jetpack 6
elliotberman May 6, 2025
9bd20ea
cudnn-samples: Use cudnn v9 in CUDA 12
elliotberman May 6, 2025
0074074
samples: Patch fixes for jetpack 6
elliotberman May 6, 2025
a5d36e5
cuda-packages: shared library resolution for jetpack 6
elliotberman May 7, 2025
b9576a1
cuda-packages: Add cuda 12.6 version configuration
elliotberman May 7, 2025
1ba05b7
cuda-packages: cuda_gdb: Don't bail if our python version isn't found
elliotberman May 7, 2025
0e2e4bc
cuda-packages: cuda_nvcc: Align with ConnorBaker/cuda-packages
elliotberman May 7, 2025
bf87be9
cuda-samples: Compile from GitHub source in CUDA 12
elliotberman May 7, 2025
d160ea9
nixos module: Default to jetpack 6 for orin and generic
elliotberman May 7, 2025
00be243
flake: Add flash scripts/capsule updates for orin + jetpack 5
elliotberman May 8, 2025
078f6cf
initrd flashing: Updates for r36
elliotberman May 9, 2025
faecb37
r36: early bring your own kernel support
elliotberman May 9, 2025
fe35ed3
Add iso installers for jetpack 5
elliotberman May 9, 2025
3becd7c
Enable early usb support
elliotberman May 9, 2025
46810e6
l4t-multimedia: Drop unneeded patches in L4T r36
elliotberman May 12, 2025
69bc1ef
Support for early networking stack
elliotberman May 14, 2025
01963dd
tests: oci: Use r36.4.0 container for jetpack 6
elliotberman May 15, 2025
185a449
Package libcupva 2.5 in jetpack 6
elliotberman May 19, 2025
d86fc78
README: Update for JetPack 6
elliotberman Jun 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 28 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# NixOS module for NVIDIA Jetson devices

This repository packages components from NVIDIA's [Jetpack SDK](https://developer.nvidia.com/embedded/jetpack) for use with NixOS, including:
This repository packages components from NVIDIA's [JetPack SDK](https://developer.nvidia.com/embedded/jetpack) for use with NixOS, including:
* Platform firmware flashing scripts
* A 5.10 Linux kernel from NVIDIA, which includes some open-source drivers like nvgpu
* An [EDK2-based UEFI firmware](https://github.com/NVIDIA/edk2-nvidia)
Expand All @@ -11,19 +11,22 @@ This repository packages components from NVIDIA's [Jetpack SDK](https://develope
- Graphics: Wayland, GBM, EGL, Vulkan
- Power/fan control: nvpmodel, nvfancontrol

This package is based on the Jetpack 5 release, and will only work with devices supported by Jetpack 5.1:
* Jetson Orin AGX
* Jetson Orin NX
* Jetson Xavier AGX
* Jetson Xavier NX
This package supports JetPack 5 and 6. It works with NVIDIA's developer kits supported by these versions only:

The Jetson Nano, TX2, and TX1 devices are _not_ supported, since support for them was dropped upstream in Jetpack 5.
In the future, when the Orin Nano is released, it should be possible to make it work as well.
| Device | JetPack 5 | JetPack 6 |
| ------------------ | --------- | --------- |
| Jetson Orin AGX | ✓ | ✓ |
| Jetson Orin NX | ✓ | ✓ |
| Jetson Orin Nano | ✓ | ✓ |
| Jetson Xavier AGX | ✓ | |
| Jetson Xavier NX | ✓ | |

The Jetson Nano, TX2, and TX1 devices are _not_ supported, since support for them was dropped upstream in JetPack 5.

## Getting started

### Flashing UEFI firmware
This step may be optional if your device already has recent-enough firmware which includes UEFI. (Post-Jetpack 5. Only newly shipped Orin devices might have this)
This step may be optional if your device already has recent-enough firmware which includes UEFI. (Post-JetPack 5. Only newly shipped Orin devices might have this)
If you are unsure, I'd recommend flashing the firmware anyway.

Plug in your Jetson device, press the "power" button" and ensure the power light turns on.
Expand All @@ -49,7 +52,7 @@ At this point, your device should have a working UEFI firmware accessible either

Now, build and write the customized installer ISO to a USB drive:
```shell
$ nix build github:anduril/jetpack-nixos#iso_minimal
$ nix build github:anduril/jetpack-nixos#iso_minimal # iso_minimal_jp5 for Xavier (or otherwise wanting to use JetPack 5)
$ sudo dd if=./result/iso/nixos-22.11pre-git-aarch64-linux.iso of=/dev/sdX bs=1M oflag=sync status=progress
```
(Replace `/dev/sdX` with the correct path for your USB drive)
Expand Down Expand Up @@ -95,6 +98,20 @@ Concretely, that means that you cannot modify the EFI variables from Linux, so U
You may need to enter the firmware menu and reorder it manually so NixOS will boot first.
(See [this issue](https://forums.developer.nvidia.com/t/using-uefi-runtime-variables-on-xavier-agx/227970))

### JetPack Versions
The major JetPack version may be changed by setting `hardware.nvidia-jetpack.majorVersion`.
It defaults to the latest version supported by the board (e.g. JetPack 6 for Orin and JetPack 5 for Xavier).
The "generic" som defaults to JetPack 6.

Note that the JetPack firmware of a given version is incompatible with the kernel and rootfs of
the other. You cannot run the JetPack 5 firmware with the JetPack 6 kernel (and vice versa). Be
certain when upgrading that you are able to update both simulatenously.

If not installing JetPack 6 firmware via flashing scripts, it is recommended to install the
JetPack 6 bootloader configuration (without live switch), then install the capsule update,
and finally reboot. The effect is that the device reboots, installs the JetPack 6 firmware
via a capsule update, and when finished, boots into a NixOS configuration for JetPack 6.

### Graphical Output
As of 2023-12-09, the status of graphical output on Jetsons is described below.
If you have problems with configurations that are expected to work, try different ports (HDMI/DP/USB-C), different cables, and rebooting with the cables initially connected or disconnected.
Expand Down Expand Up @@ -127,7 +144,7 @@ Set `hardware.nvidia-jetpack.modesetting.enable = true;`
Weston and sway have been tested working on Orin devices, but do not work on Xavier devices.

### Updating firmware from device
Recent versions of Jetpack (>=5.1) support updating the device firmware from the device using the UEFI Capsule update mechanism.
Recent versions of JetPack (>=5.1) support updating the device firmware from the device using the UEFI Capsule update mechanism.
This can be done as a more convenient alternative to physically attaching to the device and re-running the flash script.
These updates can be performed automatically after a `nixos-rebuild switch` if the `hardware.nvidia-jetpack.bootloader.autoUpdate` setting is set to true.
Otherwise, the instructions to apply the update manually are below.
Expand Down
3 changes: 3 additions & 0 deletions device-pkgs/flash-script.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
${lib.optionalString (dtbsDir != null) "cp -r ${dtbsDir}/. kernel/dtb/"}
${lib.optionalString (uefi-firmware != null) ''
cp ${uefi-firmware}/uefi_jetson.bin bootloader/uefi_jetson.bin
if [ -e "${uefi-firmware}/uefi_jetson_minimal.bin" ] ; then
cp ${uefi-firmware}/uefi_jetson_minimal.bin bootloader/uefi_jetson_minimal.bin
fi

# For normal NixOS usage, we'd probably use systemd-boot or GRUB instead,
# but lets replace the upstream L4TLauncher EFI payload anyway
Expand Down
23 changes: 19 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
buildPlatform = "x86_64-linux";
hostPlatform = "aarch64-linux";
};

};
jetpack5_config = {
hardware.nvidia-jetpack.majorVersion = "5";
};
in
{
Expand All @@ -45,6 +47,12 @@
installer_minimal_cross = nixpkgs.lib.nixosSystem {
modules = [ aarch64_cross_config installer_minimal_config ];
};
installer_minimal_jp5 = nixpkgs.lib.nixosSystem {
modules = [ aarch64_config installer_minimal_config jetpack5_config ];
};
installer_minimal_cross_jp5 = nixpkgs.lib.nixosSystem {
modules = [ aarch64_cross_config installer_minimal_config jetpack5_config ];
};
};

nixosModules.default = import ./modules/default.nix;
Expand All @@ -56,7 +64,7 @@
let
supportedConfigurations = lib.listToAttrs (map
(c: {
name = "${c.som}" + (lib.optionalString (c.super or false) "-super") + "-${c.carrierBoard}";
name = c.som + lib.optionalString (c.super or false) "-super" + "-${c.carrierBoard}" + lib.optionalString (c ? majorVersion) "-jp${c.majorVersion}";
value = c;
}) [
{ som = "orin-agx"; carrierBoard = "devkit"; }
Expand All @@ -65,6 +73,12 @@
{ som = "orin-nano"; carrierBoard = "devkit"; }
{ som = "orin-nx"; carrierBoard = "devkit"; super = true; }
{ som = "orin-nano"; carrierBoard = "devkit"; super = true; }
{ som = "orin-agx"; carrierBoard = "devkit"; majorVersion = "5"; }
{ som = "orin-agx-industrial"; carrierBoard = "devkit"; majorVersion = "5"; }
{ som = "orin-nx"; carrierBoard = "devkit"; majorVersion = "5"; }
{ som = "orin-nano"; carrierBoard = "devkit"; majorVersion = "5"; }
{ som = "orin-nx"; carrierBoard = "devkit"; super = true; majorVersion = "5"; }
{ som = "orin-nano"; carrierBoard = "devkit"; super = true; majorVersion = "5"; }
{ som = "xavier-agx"; carrierBoard = "devkit"; }
{ som = "xavier-agx-industrial"; carrierBoard = "devkit"; } # TODO: Entirely untested
{ som = "xavier-nx"; carrierBoard = "devkit"; }
Expand All @@ -89,8 +103,8 @@
uefiCapsuleUpdates = lib.mapAttrs' (n: c: lib.nameValuePair "uefi-capsule-update-${n}" c.system.build.uefiCapsuleUpdate) supportedNixOSConfigurations;
in
{
# TODO: Untested
iso_minimal = self.nixosConfigurations.installer_minimal_cross.config.system.build.isoImage;
iso_minimal_jp5 = self.nixosConfigurations.installer_minimal_cross_jp5.config.system.build.isoImage;

inherit (self.legacyPackages.x86_64-linux)
board-automation python-jetson;
Expand All @@ -104,6 +118,7 @@

aarch64-linux = {
iso_minimal = self.nixosConfigurations.installer_minimal.config.system.build.isoImage;
iso_minimal_jp5 = self.nixosConfigurations.installer_minimal_jp5.config.system.build.isoImage;
};
};

Expand Down Expand Up @@ -140,7 +155,7 @@
];
});
in
pkgs.nvidia-jetpack // { inherit (pkgs) nvidia-jetpack5; }
pkgs.nvidia-jetpack // { inherit (pkgs) nvidia-jetpack5 nvidia-jetpack6; }
);
};
}
22 changes: 16 additions & 6 deletions mk-overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{ jetpackMajorMinorPatchVersion
, l4tMajorMinorPatchVersion
, cudaMajorMinorPatchVersion
, cudaDriverMajorMinorVersion
, bspHash
}:
final: _:
Expand All @@ -27,6 +28,9 @@ let

l4tMajorVersion = versions.major l4tMajorMinorPatchVersion;

l4tAtLeast = versionAtLeast l4tMajorMinorPatchVersion;
l4tOlder = versionOlder l4tMajorMinorPatchVersion;

sourceInfo = import ./sourceinfo {
inherit l4tMajorMinorPatchVersion;
inherit (final) lib fetchurl fetchgit;
Expand All @@ -35,6 +39,7 @@ in
makeScope final.newScope (self: {
inherit (sourceInfo) debs gitRepos;
inherit jetpackMajorMinorPatchVersion l4tMajorMinorPatchVersion cudaMajorMinorVersion;
inherit l4tAtLeast l4tOlder;

callPackages = callPackagesWith (final // self);

Expand Down Expand Up @@ -85,7 +90,7 @@ makeScope final.newScope (self: {
# Nvidia's recommended toolchain is gcc9:
# https://nv-tegra.nvidia.com/r/gitweb?p=tegra/optee-src/nv-optee.git;a=blob;f=optee/atf_and_optee_README.txt;h=591edda3d4ec96997e054ebd21fc8326983d3464;hb=5ac2ab218ba9116f1df4a0bb5092b1f6d810e8f7#l33
stdenv = final.gcc9Stdenv;
inherit (self) bspSrc gitRepos l4tMajorMinorPatchVersion uefi-firmware;
inherit (self) bspSrc gitRepos l4tMajorMinorPatchVersion l4tAtLeast uefi-firmware;
}) buildTOS buildOpteeTaDevKit opteeClient;
genEkb = self.callPackage ./pkgs/optee/gen-ekb.nix { };

Expand Down Expand Up @@ -130,11 +135,15 @@ makeScope final.newScope (self: {
inherit (finalSamples) callPackage;
});

tests = final.callPackages ./pkgs/tests { inherit l4tMajorMinorPatchVersion; };
tests = final.callPackages ./pkgs/tests { inherit l4tMajorMinorPatchVersion l4tAtLeast; };

kernelPackagesOverlay = final: _: {
nvidia-display-driver = final.callPackage ./pkgs/kernels/r${l4tMajorVersion}/display-driver.nix { inherit (self) gitRepos l4tMajorMinorPatchVersion; };
};
kernelPackagesOverlay = final: _:
if self.l4tAtLeast "36" then {
devicetree = self.callPackage ./pkgs/kernels/r${l4tMajorVersion}/devicetree.nix { };
nvidia-oot-modules = final.callPackage ./pkgs/kernels/r${l4tMajorVersion}/oot-modules.nix { inherit (self) bspSrc gitRepos l4tMajorMinorPatchVersion; };
} else {
nvidia-display-driver = final.callPackage ./pkgs/kernels/r${l4tMajorVersion}/display-driver.nix { inherit (self) gitRepos l4tMajorMinorPatchVersion; };
};

kernel = self.callPackage ./pkgs/kernels/r${l4tMajorVersion} { kernelPatches = [ ]; };
kernelPackages = (final.linuxPackagesFor self.kernel).extend self.kernelPackagesOverlay;
Expand Down Expand Up @@ -171,5 +180,6 @@ makeScope final.newScope (self: {
# attribute set, we cannot use self.callPackages because we would end up with infinite recursion.
# Instead, we must either use final.callPackages or packagesFromDirectoryRecursive.
// final.callPackages ./pkgs/l4t {
inherit (self) debs l4tMajorMinorPatchVersion;
inherit (self) debs;
inherit l4tMajorMinorPatchVersion cudaDriverMajorMinorVersion l4tAtLeast l4tOlder;
})
Loading