nvidia-{docker,podman}: use buildGoModule

+19 -9
+19 -9
pkgs/applications/virtualization/nvidia-container-toolkit/default.nix
··· 2 2 , glibc 3 3 , fetchFromGitLab 4 4 , makeWrapper 5 - , buildGoPackage 5 + , buildGoModule 6 6 , linkFarm 7 7 , writeShellScript 8 8 , containerRuntimePath ··· 24 24 fi 25 25 ''; 26 26 in 27 - buildGoPackage rec { 27 + buildGoModule rec { 28 28 pname = "container-toolkit/container-toolkit"; 29 29 version = "1.9.0"; 30 30 ··· 32 32 owner = "nvidia"; 33 33 repo = pname; 34 34 rev = "v${version}"; 35 - sha256 = "sha256-b4mybNB5FqizFTraByHk5SCsNO66JaISj18nLgLN7IA="; 35 + hash = "sha256-b4mybNB5FqizFTraByHk5SCsNO66JaISj18nLgLN7IA="; 36 36 }; 37 37 38 - goPackagePath = "github.com/NVIDIA/nvidia-container-toolkit"; 38 + vendorHash = null; 39 + 40 + postPatch = '' 41 + # replace the default hookDefaultFilePath to the $out path 42 + substituteInPlace cmd/nvidia-container-runtime/main.go \ 43 + --replace '/usr/bin/nvidia-container-runtime-hook' '${placeholder "out"}/bin/nvidia-container-runtime-hook' 44 + ''; 39 45 40 46 ldflags = [ "-s" "-w" ]; 41 47 42 48 nativeBuildInputs = [ makeWrapper ]; 43 49 44 - preBuild = '' 45 - # replace the default hookDefaultFilePath to the $out path 46 - substituteInPlace go/src/github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-container-runtime/main.go \ 47 - --replace '/usr/bin/nvidia-container-runtime-hook' '${placeholder "out"}/bin/nvidia-container-runtime-hook' 48 - ''; 50 + checkFlags = 51 + let 52 + skippedTests = [ 53 + # Disable tests executing nvidia-container-runtime command. 54 + "TestGoodInput" 55 + "TestDuplicateHook" 56 + ]; 57 + in 58 + [ "-skip" "${builtins.concatStringsSep "|" skippedTests}" ]; 49 59 50 60 postInstall = '' 51 61 mkdir -p $out/etc/nvidia-container-runtime