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