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/nixos/modules/services/hardware/nvidia-container-toolkit/default.nix b/nixos/modules/services/hardware/nvidia-container-toolkit/default.nix index 3538e52bda3bdb..633309ab97c13c 100644 --- a/nixos/modules/services/hardware/nvidia-container-toolkit/default.nix +++ b/nixos/modules/services/hardware/nvidia-container-toolkit/default.nix @@ -111,7 +111,9 @@ { hostPath = "${lib.getLib pkgs.glibc}/lib"; containerPath = "${lib.getLib pkgs.glibc}/lib"; } { hostPath = "${lib.getLib pkgs.glibc}/lib64"; - containerPath = "${lib.getLib pkgs.glibc}/lib64"; }] + containerPath = "${lib.getLib pkgs.glibc}/lib64"; } + { hostPath = lib.getExe' config.hardware.nvidia-container-toolkit.package.tools "nvidia-cdi-hook"; + containerPath = "/usr/bin/nvidia-cdi-hook"; }] (lib.mkIf config.hardware.nvidia-container-toolkit.mount-nvidia-executables [{ hostPath = lib.getExe' nvidia-driver "nvidia-cuda-mps-control"; containerPath = "/usr/bin/nvidia-cuda-mps-control"; } diff --git a/pkgs/by-name/nv/nvidia-container-toolkit/package.nix b/pkgs/by-name/nv/nvidia-container-toolkit/package.nix index aa4f28e72e83f9..d14d7da4ea032d 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="; }; @@ -50,23 +50,13 @@ buildGoModule rec { ./0001-Add-dlopen-discoverer.patch ]; - 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 '/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 @@ -104,7 +94,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