Skip to content

Commit

Permalink
nvidia-container-toolkit: 1.15.0-rc.3 -> 1.17.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ereslibre committed Jan 1, 2025
1 parent d8d3c38 commit 30db459
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
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"} \
--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.tools "nvidia-cdi-hook";
containerPath = lib.getExe' config.hardware.nvidia-container-toolkit.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

0 comments on commit 30db459

Please sign in to comment.