nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 141 lines 2.8 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 rocmUpdateScript, 6 cmake, 7 amdsmi, 8 rocm-smi, 9 rocm-runtime, 10 libcap, 11 libdrm, 12 grpc, 13 protobuf, 14 openssl, 15 doxygen, 16 graphviz, 17 texliveSmall, 18 gtest, 19 buildDocs ? true, 20 buildTests ? false, 21}: 22 23let 24 latex = lib.optionalAttrs buildDocs ( 25 texliveSmall.withPackages ( 26 ps: with ps; [ 27 changepage 28 latexmk 29 varwidth 30 multirow 31 hanging 32 adjustbox 33 collectbox 34 stackengine 35 enumitem 36 alphalph 37 wasysym 38 sectsty 39 tocloft 40 newunicodechar 41 etoc 42 helvetic 43 wasy 44 courier 45 ] 46 ) 47 ); 48in 49stdenv.mkDerivation (finalAttrs: { 50 pname = "rdc"; 51 version = "6.3.3"; 52 53 outputs = [ 54 "out" 55 ] 56 ++ lib.optionals buildDocs [ 57 "doc" 58 ] 59 ++ lib.optionals buildTests [ 60 "test" 61 ]; 62 63 src = fetchFromGitHub { 64 owner = "ROCm"; 65 repo = "rdc"; 66 rev = "rocm-${finalAttrs.version}"; 67 hash = "sha256-s/31b8/Kn5l1QJ941UMSB8SCzpvODsPfOLMmEBUYYmY="; 68 }; 69 70 nativeBuildInputs = [ 71 cmake 72 protobuf 73 ] 74 ++ lib.optionals buildDocs [ 75 doxygen 76 graphviz 77 latex 78 ]; 79 80 buildInputs = [ 81 amdsmi 82 rocm-smi 83 rocm-runtime 84 libcap 85 libdrm 86 grpc 87 openssl 88 ] 89 ++ lib.optionals buildTests [ 90 gtest 91 ]; 92 93 CXXFLAGS = "-I${libcap.dev}/include"; 94 95 cmakeFlags = [ 96 "-DCMAKE_VERBOSE_MAKEFILE=OFF" 97 "-DRDC_INSTALL_PREFIX=${placeholder "out"}" 98 "-DBUILD_ROCRTEST=ON" 99 "-DRSMI_INC_DIR=${rocm-smi}/include" 100 "-DRSMI_LIB_DIR=${rocm-smi}/lib" 101 "-DGRPC_ROOT=${grpc}" 102 # Manually define CMAKE_INSTALL_<DIR> 103 # See: https://github.com/NixOS/nixpkgs/pull/197838 104 "-DCMAKE_INSTALL_BINDIR=bin" 105 "-DCMAKE_INSTALL_LIBDIR=lib" 106 "-DCMAKE_INSTALL_INCLUDEDIR=include" 107 "-DCMAKE_INSTALL_LIBEXECDIR=libexec" 108 "-DCMAKE_INSTALL_DOCDIR=doc" 109 ] 110 ++ lib.optionals buildTests [ 111 "-DBUILD_TESTS=ON" 112 ]; 113 114 postPatch = '' 115 substituteInPlace CMakeLists.txt \ 116 --replace "file(STRINGS /etc/os-release LINUX_DISTRO LIMIT_COUNT 1 REGEX \"NAME=\")" "set(LINUX_DISTRO \"NixOS\")" 117 ''; 118 119 postInstall = '' 120 find $out/bin -executable -type f -exec \ 121 patchelf {} --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" \; 122 '' 123 + lib.optionalString buildTests '' 124 mkdir -p $test 125 mv $out/bin/rdctst_tests $test/bin 126 ''; 127 128 passthru.updateScript = rocmUpdateScript { 129 name = finalAttrs.pname; 130 inherit (finalAttrs.src) owner; 131 inherit (finalAttrs.src) repo; 132 }; 133 134 meta = with lib; { 135 description = "Simplifies administration and addresses infrastructure challenges in cluster and datacenter environments"; 136 homepage = "https://github.com/ROCm/rdc"; 137 license = with licenses; [ mit ]; 138 teams = [ teams.rocm ]; 139 platforms = platforms.linux; 140 }; 141})