Skip to content

Commit 7bd6de8

Browse files
committed
Add create-libegl-symlink service
1 parent d9530d5 commit 7bd6de8

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

modules/default.nix

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,33 @@ in
408408
# Include nv_tegra_release, just so we can tell what version our NixOS machine was built from.
409409
environment.etc."nv_tegra_release".source = "${pkgs.nvidia-jetpack.l4t-core}/etc/nv_tegra_release";
410410

411+
# For some unknown reason the libnvscf.so library has a dlopen call to a hard path:
412+
# `/usr/lib/aarch64-linux-gnu/tegra-egl/libEGL_nvidia.so.0`
413+
# This causes loading errors for libargus applications and the nvargus-daemon
414+
# Errors will look like this:
415+
# SCF: Error NotSupported: Failed to load EGL library
416+
# To fix this create a symlink to the correct EGL lib at the above directory.
417+
systemd.services.create-libegl-symlink =
418+
let
419+
linkEglLib = pkgs.writeShellScriptBin "link-egl-lib" ''
420+
${lib.getExe' pkgs.coreutils "mkdir"} -p /usr/lib/aarch64-linux-gnu/tegra-egl
421+
${lib.getExe' pkgs.coreutils "ln"} -s /run/opengl-driver/lib/libEGL_nvidia.so.0 /usr/lib/aarch64-linux-gnu/tegra-egl/libEGL_nvidia.so.0
422+
'';
423+
in
424+
{
425+
enable = true;
426+
description = "Create a symlink for libEGL_nvidia.so.0 at /usr/lib/aarch64-linux-gnu/tegra-egl/";
427+
unitConfig = {
428+
ConditionPathExists = "!/usr/lib/aarch64-linux-gnu/tegra-egl/libEGL_nvidia.so.0";
429+
};
430+
serviceConfig = {
431+
type = "oneshot";
432+
ExecStart = lib.getExe linkEglLib;
433+
};
434+
wantedBy = [ "multi-user.target" ];
435+
};
436+
437+
411438
# https://developer.ridgerun.com/wiki/index.php/Xavier/JetPack_5.0.2/Performance_Tuning
412439
systemd.services.jetson_clocks = mkIf cfg.maxClock {
413440
enable = true;

0 commit comments

Comments
 (0)