2019-02-27 08:44:05 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, fetchpatch, callPackage, makeWrapper
|
2019-06-16 20:59:06 +01:00
|
|
|
, buildGoPackage, runc, glibc }:
|
2019-02-27 08:44:05 +00:00
|
|
|
|
|
|
|
with lib; let
|
|
|
|
|
|
|
|
libnvidia-container = callPackage ./libnvc.nix { };
|
|
|
|
|
|
|
|
nvidia-container-runtime = fetchFromGitHub {
|
|
|
|
owner = "NVIDIA";
|
|
|
|
repo = "nvidia-container-runtime";
|
|
|
|
rev = "runtime-v2.0.0";
|
|
|
|
sha256 = "0jcj5xxbg7x7gyhbb67h3ds6vly62gx7j02zm6lg102h34jajj7a";
|
|
|
|
};
|
|
|
|
|
2019-08-13 22:52:01 +01:00
|
|
|
nvidia-container-runtime-hook = buildGoPackage {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "nvidia-container-runtime-hook";
|
2019-02-27 08:44:05 +00:00
|
|
|
version = "1.4.0";
|
|
|
|
|
|
|
|
goPackagePath = "nvidia-container-runtime-hook";
|
|
|
|
|
|
|
|
src = "${nvidia-container-runtime}/hook/nvidia-container-runtime-hook";
|
|
|
|
};
|
|
|
|
|
|
|
|
nvidia-runc = runc.overrideAttrs (oldAttrs: rec {
|
|
|
|
name = "nvidia-runc";
|
|
|
|
version = "1.0.0-rc6";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "opencontainers";
|
|
|
|
repo = "runc";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "1jwacb8xnmx5fr86gximhbl9dlbdwj3rpf27hav9q1si86w5pb1j";
|
|
|
|
};
|
|
|
|
patches = [ "${nvidia-container-runtime}/runtime/runc/3f2f8b84a77f73d38244dd690525642a72156c64/0001-Add-prestart-hook-nvidia-container-runtime-hook-to-t.patch" ];
|
|
|
|
});
|
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "nvidia-docker";
|
2019-02-27 08:44:05 +00:00
|
|
|
version = "2.0.3";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "NVIDIA";
|
|
|
|
repo = "nvidia-docker";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "1vx5m591mnvcb9vy0196x5lh3r8swjsk0fnlv5h62m7m4m07v6wx";
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
mkdir bin
|
|
|
|
cp nvidia-docker bin
|
|
|
|
cp ${libnvidia-container}/bin/nvidia-container-cli bin
|
|
|
|
cp ${nvidia-container-runtime-hook}/bin/nvidia-container-runtime-hook bin
|
|
|
|
cp ${nvidia-runc}/bin/runc bin/nvidia-container-runtime
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/{bin,etc}
|
|
|
|
cp -r bin $out
|
|
|
|
wrapProgram $out/bin/nvidia-container-cli \
|
|
|
|
--prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:/run/opengl-driver-32/lib
|
|
|
|
cp ${./config.toml} $out/etc/config.toml
|
2020-07-29 23:36:30 +01:00
|
|
|
substituteInPlace $out/etc/config.toml --subst-var-by glibcbin ${lib.getBin glibc}
|
2019-02-27 08:44:05 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/NVIDIA/nvidia-docker";
|
2019-02-27 08:44:05 +00:00
|
|
|
description = "NVIDIA container runtime for Docker";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|