blob: d31b3a076cecd6e5ff8e3089c8036b11ceee661d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
EGO_PN="github.com/NVIDIA/${PN}"
inherit flag-o-matic go-module systemd
DESCRIPTION="NVIDIA container runtime toolkit"
HOMEPAGE="https://github.com/NVIDIA/nvidia-container-toolkit"
if [[ "${PV}" == "9999" ]] ; then
inherit git-r3
EGIT_REPO_URI="https://github.com/NVIDIA/${PN}.git"
else
SRC_URI="
https://github.com/NVIDIA/${PN}/archive/v${PV/_rc/-rc.}.tar.gz -> ${P}.tar.gz
"
S="${WORKDIR}/${PN}-${PV/_rc/-rc.}"
KEYWORDS="~amd64"
fi
LICENSE="Apache-2.0"
SLOT="0/${PV}"
# Some tests may require specific environmental setups or additional hardware.
RESTRICT="test" # Bug 831702
RDEPEND="
sys-libs/libnvidia-container
"
src_prepare() {
default
# grep lives in /bin on split-usr
sed -i 's|/usr/bin/grep|grep|g' deployments/systemd/nvidia-cdi-refresh.service || die
}
src_configure() {
# -fno-plt causes NVML symbols to be resolved before go-nvml can dlopen libnvidia-ml.so.1.
filter-flags -fno-plt
# Gentoo enables immediate binding by default; NVML requires lazy binding.
append-ldflags -Wl,-z,lazy
go-module_src_configure
}
src_compile() {
emake binaries
}
src_install() {
dobin nvidia-cdi-hook \
nvidia-container-runtime \
nvidia-container-runtime.cdi \
nvidia-container-runtime.legacy \
nvidia-container-runtime-hook \
nvidia-ctk
insinto "/etc/nvidia-container-runtime"
doins "${FILESDIR}/config.toml"
systemd_dounit deployments/systemd/nvidia-cdi-refresh.{path,service}
insinto /usr/lib/systemd/system/nvidia-cdi-refresh.service.d
doins deployments/systemd/10-container-engines.conf
insinto "/etc/nvidia-container-toolkit"
doins deployments/systemd/nvidia-cdi-refresh.env
}
pkg_postinst() {
elog "Your docker or containerd (if applicable) service may need restart"
elog "after install this package:"
elog "OpenRC: rc-service containerd restart; rc-service docker restart"
elog "systemd: systemctl restart containerd; systemctl restart docker"
elog "You may need to edit your /etc/nvidia-container-runtime/config.toml"
elog "file before running ${PN} for the first time."
elog "For details, please see the NVIDIA docker manual page."
elog
elog "To regenerate the CDI specification on boot and on driver or toolkit"
elog "upgrades, enable both systemd units:"
elog "systemctl enable nvidia-cdi-refresh.path nvidia-cdi-refresh.service"
}
|