Skip to content

Commit

Permalink
Use driverLink where possible
Browse files Browse the repository at this point in the history
Instead of hardcoding `/run/opengl-driver`, use `addOpenGLRunpath.driverLink`.
  • Loading branch information
jmbaur authored and danielfullmer committed Mar 26, 2024
1 parent 6ae4ce1 commit e17355e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ in
# l4t-core provides - among others - libnvrm_gpu.so and libnvrm_mem.so.
# The l4t-core/lib directory is directly set in the DT_RUNPATH of
# l4t-cuda's libcuda.so, thus the standard driver doesn't need them to be
# added in /run/opengl-driver.
# added in ${driverLink}.
#
# However, this isn't the case for cuda_compat's driver currently, which
# is why we're including this derivation in extraPackages.
Expand Down Expand Up @@ -269,6 +269,7 @@ in
};

# Used by libEGL_nvidia.so.0
environment.etc."egl/egl_external_platform.d".source = "/run/opengl-driver/share/egl/egl_external_platform.d/";
environment.etc."egl/egl_external_platform.d".source =
"${pkgs.addOpenGLRunpath.driverLink}/share/egl/egl_external_platform.d/";
};
}
5 changes: 3 additions & 2 deletions pkgs/l4t/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{ stdenv
, stdenvNoCC
, addOpenGLRunpath
, lib
, fetchurl
, fetchpatch
Expand Down Expand Up @@ -94,15 +95,15 @@ let
# l4t-core. Unfortunately, calling dlopen from libnvos.so instead of the
# original library/executable means that dlopen will use the DT_RUNPATH
# from libnvos.so instead of the binary/library which called it. We
# typically just need /run/opengl-driver/lib anyway, so lets add it to
# typically just need ${driverLink}/lib anyway, so lets add it to
# libnvos.so here instead.
#
# We append a postFixupHook since we need to have this happen after
# autoPatchelfHook, which itself also runs as a postFixupHook.
# TODO: Use runtimeDependencies instead
preFixup = ''
postFixupHooks+=('
patchelf --add-rpath /run/opengl-driver/lib $out/lib/libnvos.so
patchelf --add-rpath ${addOpenGLRunpath.driverLink}/lib $out/lib/libnvos.so
')
'';
};
Expand Down

0 comments on commit e17355e

Please sign in to comment.