Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nvidia-container-toolkit: 1.15.0-rc.3 -> 1.17.3 #367769

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thank you keeping up the work on nvidia ctk! Anything missing for this PR to be undrafted?

Copy link
Member Author

@ereslibre ereslibre Jan 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! I am checking some behaviors with the hooks and in particular with #366109.

When I'm done with the checks I'll move it out of draft. In FHS distros (e.g. ubuntu) I see that hooks are not working as expected and I want to understand what is going on exactly. Similar with NixOS containers, although different, given we don't have ldcache we'd need to fallback to LD_LIBRARY_PATH, but I don't see a good strategy there, given OCI hooks don't allow us to "augment" the envvar (e.g. LD_LIBRARY_PATH=something/new:$LD_LIBRARY_PATH).

I could just bump the version and continue these checks in parallel but let me do a quick check and if I see it's taking longer than expected we can just bump and investigate afterwards.

Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ writeScriptBin "nvidia-cdi-generator" ''
${lib.getExe' nvidia-container-toolkit "nvidia-ctk"} cdi generate \
--format json \
--device-name-strategy ${deviceNameStrategy} \
--ldconfig-path ${lib.getExe' glibc "ldconfig"} \
--ldconfig-path ${lib.getExe' glibc.bin "ldconfig"} \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, I thought getExe would select .bin automatically?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, will update

--library-search-path ${lib.getLib nvidia-driver}/lib \
--nvidia-ctk-path ${lib.getExe' nvidia-container-toolkit "nvidia-ctk"}
--nvidia-cdi-hook-path ${lib.getExe' nvidia-container-toolkit.tools "nvidia-cdi-hook"}
}

function additionalMount {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,16 @@
in (lib.mkMerge [
[{ hostPath = pkgs.addDriverRunpath.driverLink;
containerPath = pkgs.addDriverRunpath.driverLink; }
{ hostPath = lib.getExe' config.hardware.nvidia-container-toolkit.package "nvidia-ctk";
containerPath = lib.getExe' config.hardware.nvidia-container-toolkit.package "nvidia-ctk"; }
{ hostPath = lib.getExe' config.hardware.nvidia-container-toolkit.package.tools "nvidia-cdi-hook";
containerPath = lib.getExe' config.hardware.nvidia-container-toolkit.package.tools "nvidia-cdi-hook"; }
{ hostPath = "${lib.getLib nvidia-driver}/etc";
containerPath = "${lib.getLib nvidia-driver}/etc"; }
{ hostPath = "${lib.getLib nvidia-driver}/share";
containerPath = "${lib.getLib nvidia-driver}/share"; }
{ hostPath = lib.getExe' pkgs.glibc.bin "ldconfig";
containerPath = lib.getExe' pkgs.glibc.bin "ldconfig"; }
{ hostPath = "${lib.getLib pkgs.glibc}/lib";
containerPath = "${lib.getLib pkgs.glibc}/lib"; }
{ hostPath = "${lib.getLib pkgs.glibc}/lib64";
Expand Down
33 changes: 16 additions & 17 deletions pkgs/by-name/nv/nvidia-container-toolkit/package.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
lib,
glibc,
fetchFromGitLab,
fetchFromGitHub,
makeWrapper,
buildGoModule,
formats,
Expand All @@ -26,14 +26,14 @@ let
cliVersionPackage = "github.com/NVIDIA/nvidia-container-toolkit/internal/info";
in
buildGoModule rec {
pname = "container-toolkit/container-toolkit";
version = "1.15.0-rc.3";
pname = "nvidia-container-toolkit";
version = "1.17.3";

src = fetchFromGitLab {
owner = "nvidia";
src = fetchFromGitHub {
owner = "NVIDIA";
repo = pname;
rev = "v${version}";
hash = "sha256-IH2OjaLbcKSGG44aggolAOuJkjk+GaXnnTbrXfZ0lVo=";
hash = "sha256-o3zkCkX6pmmdNb+K5nObhkItYJ6OaZBpW61sl7/hKPg=";

};

Expand All @@ -51,23 +51,22 @@ buildGoModule rec {
];

postPatch = ''
# Replace the default hookDefaultFilePath to the $out path and override
# default ldconfig locations to the one in nixpkgs.

substituteInPlace internal/config/config.go \
--replace '/usr/bin/nvidia-container-runtime-hook' "$out/bin/nvidia-container-runtime-hook" \
--replace '/sbin/ldconfig' '${lib.getBin glibc}/sbin/ldconfig'

substituteInPlace internal/config/config_test.go \
--replace '/usr/bin/nvidia-container-runtime-hook' "$tools/bin/nvidia-container-runtime-hook" \
--replace '/sbin/ldconfig' '${lib.getBin glibc}/sbin/ldconfig'

substituteInPlace tools/container/toolkit/toolkit.go \
--replace '/sbin/ldconfig' '${lib.getBin glibc}/sbin/ldconfig'

substituteInPlace cmd/nvidia-ctk/hook/update-ldcache/update-ldcache.go \
--replace '/sbin/ldconfig' '${lib.getBin glibc}/sbin/ldconfig'
'';

subPackages = [
"cmd/nvidia-cdi-hook"
"cmd/nvidia-container-runtime.cdi"
"cmd/nvidia-container-runtime-hook"
"cmd/nvidia-container-runtime.legacy"
"cmd/nvidia-ctk"
];

# Based on upstream's Makefile:
# https://gitlab.com/nvidia/container-toolkit/container-toolkit/-/blob/03cbf9c6cd26c75afef8a2dd68e0306aace80401/Makefile#L64
ldflags = [
Expand Down Expand Up @@ -104,7 +103,7 @@ buildGoModule rec {
--prefix PATH : ${libnvidia-container}/bin

mkdir -p $tools/bin
mv $out/bin/{containerd,crio,docker,nvidia-toolkit,toolkit} $tools/bin
mv $out/bin/{nvidia-cdi-hook,nvidia-container-runtime.cdi,nvidia-container-runtime-hook,nvidia-container-runtime.legacy} $tools/bin
''
+ lib.optionalString (configTemplate != null || configTemplatePath != null) ''
mkdir -p $out/etc/nvidia-container-runtime
Expand Down
Loading