tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
nvidia-{docker,podman}: use buildGoModule
Aaron Jheng
2 years ago
88fc33d3
43bad2a8
+19
-9
1 changed file
expand all
collapse all
unified
split
pkgs
applications
virtualization
nvidia-container-toolkit
default.nix
+19
-9
pkgs/applications/virtualization/nvidia-container-toolkit/default.nix
···
2
, glibc
3
, fetchFromGitLab
4
, makeWrapper
5
-
, buildGoPackage
6
, linkFarm
7
, writeShellScript
8
, containerRuntimePath
···
24
fi
25
'';
26
in
27
-
buildGoPackage rec {
28
pname = "container-toolkit/container-toolkit";
29
version = "1.9.0";
30
···
32
owner = "nvidia";
33
repo = pname;
34
rev = "v${version}";
35
-
sha256 = "sha256-b4mybNB5FqizFTraByHk5SCsNO66JaISj18nLgLN7IA=";
36
};
37
38
-
goPackagePath = "github.com/NVIDIA/nvidia-container-toolkit";
0
0
0
0
0
0
39
40
ldflags = [ "-s" "-w" ];
41
42
nativeBuildInputs = [ makeWrapper ];
43
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
-
'';
0
0
0
0
49
50
postInstall = ''
51
mkdir -p $out/etc/nvidia-container-runtime
···
2
, glibc
3
, fetchFromGitLab
4
, makeWrapper
5
+
, buildGoModule
6
, linkFarm
7
, writeShellScript
8
, containerRuntimePath
···
24
fi
25
'';
26
in
27
+
buildGoModule rec {
28
pname = "container-toolkit/container-toolkit";
29
version = "1.9.0";
30
···
32
owner = "nvidia";
33
repo = pname;
34
rev = "v${version}";
35
+
hash = "sha256-b4mybNB5FqizFTraByHk5SCsNO66JaISj18nLgLN7IA=";
36
};
37
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
+
'';
45
46
ldflags = [ "-s" "-w" ];
47
48
nativeBuildInputs = [ makeWrapper ];
49
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}" ];
59
60
postInstall = ''
61
mkdir -p $out/etc/nvidia-container-runtime