From e6b897761cd512d09728b01f6aae37840224dac6 Mon Sep 17 00:00:00 2001 From: Cole <65095161+zeusec@users.noreply.github.com> Date: Tue, 23 Jun 2026 07:08:03 -0500 Subject: [PATCH] nvidia-container-toolkit: 1.18.2 -> 1.19.1 --- .../0001-Add-dlopen-discoverer.patch | 59 ++++++++++--------- .../nv/nvidia-container-toolkit/package.nix | 10 +++- 2 files changed, 39 insertions(+), 30 deletions(-) diff --git a/pkgs/by-name/nv/nvidia-container-toolkit/0001-Add-dlopen-discoverer.patch b/pkgs/by-name/nv/nvidia-container-toolkit/0001-Add-dlopen-discoverer.patch index ddc7d34ac7c1..9aa0b786678e 100644 --- a/pkgs/by-name/nv/nvidia-container-toolkit/0001-Add-dlopen-discoverer.patch +++ b/pkgs/by-name/nv/nvidia-container-toolkit/0001-Add-dlopen-discoverer.patch @@ -1,20 +1,20 @@ -From e4449f06a8989ff22947309151855b388c311aed Mon Sep 17 00:00:00 2001 +From 0db315c9ca1e8f2144edf020aa4dd309e889d4d1 Mon Sep 17 00:00:00 2001 From: Jared Baur Date: Mon, 22 Jan 2024 20:42:48 -0800 Subject: [PATCH] Add dlopen discoverer --- - internal/lookup/dlopen.go | 57 ++++++++++++++++++++++++++++++++++++++ - internal/lookup/library.go | 3 ++ - 2 files changed, 60 insertions(+) - create mode 100644 internal/lookup/dlopen.go + pkg/lookup/dlopen.go | 63 +++++++++++++++++++++++++++++++++++++++++++ + pkg/lookup/library.go | 1 + + 2 files changed, 64 insertions(+) + create mode 100644 pkg/lookup/dlopen.go -diff --git a/internal/lookup/dlopen.go b/internal/lookup/dlopen.go +diff --git a/pkg/lookup/dlopen.go b/pkg/lookup/dlopen.go new file mode 100644 -index 00000000..7cd84522 +index 0000000..7af8ca0 --- /dev/null -+++ b/internal/lookup/dlopen.go -@@ -0,0 +1,57 @@ ++++ b/pkg/lookup/dlopen.go +@@ -0,0 +1,63 @@ +package lookup + +// #cgo LDFLAGS: -ldl @@ -35,11 +35,17 @@ index 00000000..7cd84522 + file +} + -+// NewDlopenLocator creats a locator that can be used for locating libraries ++// NewDlopenLocator creates a locator that can be used for locating libraries +// through the dlopen mechanism. +func NewDlopenLocator(opts ...Option) Locator { -+ f := newFileLocator(opts...) -+ d := dlopenLocator{file: *f} ++ o := NewFactory(opts...) ++ f := file{ ++ logger: o.logger, ++ filter: o.filter, ++ count: o.count, ++ prefixes: getSearchPrefixes(o.root, o.searchPaths...), ++ } ++ d := dlopenLocator{file: f} + return &d +} + @@ -72,19 +78,18 @@ index 00000000..7cd84522 + + return []string{libAbsolutePath}, nil +} -diff --git a/internal/lookup/library.go b/internal/lookup/library.go -index 7f5cf7c8..916edde2 100644 ---- a/internal/lookup/library.go -+++ b/internal/lookup/library.go -@@ -61,7 +61,10 @@ func NewLibraryLocator(opts ...Option) Locator { - // We construct a symlink locator for expected library locations. - symlinkLocator := NewSymlinkLocator(opts...) - -+ dlopenLocator := NewDlopenLocator(opts...) -+ - l := First( -+ dlopenLocator, - symlinkLocator, - newLdcacheLocator(opts...), +diff --git a/pkg/lookup/library.go b/pkg/lookup/library.go +index e57bd0e..adeff77 100644 +--- a/pkg/lookup/library.go ++++ b/pkg/lookup/library.go +@@ -51,6 +51,7 @@ func NewLibraryLocator(opts ...Option) Locator { + }...), ) --- + l := First( ++ NewDlopenLocator(opts...), + NewSymlinkLocator(opts...), + f.newLdcacheLocator(), + ) +-- +2.54.0 + diff --git a/pkgs/by-name/nv/nvidia-container-toolkit/package.nix b/pkgs/by-name/nv/nvidia-container-toolkit/package.nix index 395084b81afa..96381c58dea4 100644 --- a/pkgs/by-name/nv/nvidia-container-toolkit/package.nix +++ b/pkgs/by-name/nv/nvidia-container-toolkit/package.nix @@ -13,13 +13,13 @@ let in buildGoModule (finalAttrs: { pname = "nvidia-container-toolkit"; - version = "1.18.2"; + version = "1.19.1"; src = fetchFromGitHub { owner = "NVIDIA"; repo = "nvidia-container-toolkit"; tag = "v${finalAttrs.version}"; - hash = "sha256-OMM7IQ65jPr9I5YUwVR3SXbuARnLjS2GSVq2j4J8uFY="; + hash = "sha256-0ivgJA5JY/17FIoOrOvUF7NjMMu7aXfh39sMQcabCm8="; }; @@ -33,11 +33,15 @@ buildGoModule (finalAttrs: { patches = [ # This patch causes library lookups to first attempt loading via dlopen # before falling back to the regular symlink location and ldcache location. + # Required on NixOS, where the driver libraries live outside the ldcache and + # the FHS paths that the upstream locators search. Upstream tried to add an + # equivalent locator but reverted it; tracked in + # https://github.com/NVIDIA/nvidia-container-toolkit/issues/1677 ./0001-Add-dlopen-discoverer.patch ]; postPatch = '' - substituteInPlace internal/config/config.go \ + substituteInPlace api/config/v1/config.go \ --replace-fail '/usr/bin/nvidia-container-runtime-hook' "$tools/bin/nvidia-container-runtime-hook" \ --replace-fail '/sbin/ldconfig' '${lib.getBin glibc}/sbin/ldconfig'