From 31395de87e32d56b7c3c7e86b29a455b8c395b0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Fern=C3=A1ndez=20L=C3=B3pez?= Date: Mon, 23 Dec 2024 08:35:00 +0100 Subject: [PATCH] nvidia-container-toolkit: 1.15.0-rc.3 -> 1.17.3 --- .../nvidia-container-toolkit/cdi-generate.nix | 2 +- .../nv/nvidia-container-toolkit/package.nix | 33 +++++++++---------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/nixos/modules/services/hardware/nvidia-container-toolkit/cdi-generate.nix b/nixos/modules/services/hardware/nvidia-container-toolkit/cdi-generate.nix index 78b7ec080289ba..bf4e5632271af3 100644 --- a/nixos/modules/services/hardware/nvidia-container-toolkit/cdi-generate.nix +++ b/nixos/modules/services/hardware/nvidia-container-toolkit/cdi-generate.nix @@ -39,7 +39,7 @@ writeScriptBin "nvidia-cdi-generator" '' --device-name-strategy ${deviceNameStrategy} \ --ldconfig-path ${lib.getExe' glibc "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 { diff --git a/pkgs/by-name/nv/nvidia-container-toolkit/package.nix b/pkgs/by-name/nv/nvidia-container-toolkit/package.nix index aa4f28e72e83f9..dc1905a5156582 100644 --- a/pkgs/by-name/nv/nvidia-container-toolkit/package.nix +++ b/pkgs/by-name/nv/nvidia-container-toolkit/package.nix @@ -1,7 +1,7 @@ { lib, glibc, - fetchFromGitLab, + fetchFromGitHub, makeWrapper, buildGoModule, formats, @@ -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="; }; @@ -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 = [ @@ -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