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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
{
lib,
stdenv,
fetchFromGitHub,
rocmUpdateScript,
cmake,
pkg-config,
amdsmi,
rocm-smi,
rocm-runtime,
libcap,
libdrm,
grpc,
protobuf,
openssl,
doxygen,
graphviz,
texliveSmall,
gtest,
buildDocs ? true,
buildTests ? false,
}:
let
latex = lib.optionalAttrs buildDocs (
texliveSmall.withPackages (
ps: with ps; [
changepage
latexmk
varwidth
multirow
hanging
adjustbox
collectbox
stackengine
enumitem
alphalph
wasysym
sectsty
tocloft
newunicodechar
etoc
helvetic
wasy
courier
]
)
);
in
stdenv.mkDerivation (finalAttrs: {
pname = "rdc";
version = "7.2.3";
outputs = [
"out"
]
++ lib.optionals buildDocs [
"doc"
]
++ lib.optionals buildTests [
"test"
];
src = fetchFromGitHub {
owner = "ROCm";
repo = "rocm-systems";
rev = "rocm-${finalAttrs.version}";
sparseCheckout = [
"projects/rdc"
"shared"
];
hash = "sha256-SmySauRxFnEQJVTjGYf4TpmQclTwZG2RZrk3u6ko5Qo=";
};
sourceRoot = "${finalAttrs.src.name}/projects/rdc";
patches = [
# https://github.com/ROCm/rocm-systems/pull/2423
./fix-cmake-cxxflags.patch
# https://github.com/ROCm/rocm-systems/pull/2424
./fix-libcap-pkgconfig.patch
];
nativeBuildInputs = [
cmake
pkg-config
protobuf
]
++ lib.optionals buildDocs [
doxygen
graphviz
latex
];
buildInputs = [
amdsmi
rocm-smi
rocm-runtime
libcap
libdrm
grpc
openssl
]
++ lib.optionals buildTests [
gtest
];
cmakeFlags = [
"-DCMAKE_VERBOSE_MAKEFILE=ON"
"-DRDC_INSTALL_PREFIX=${placeholder "out"}"
"-DBUILD_RVS=OFF" # TODO: Needs RVS package
"-DBUILD_ROCRTEST=ON"
"-DRSMI_INC_DIR=${rocm-smi}/include"
"-DRSMI_LIB_DIR=${rocm-smi}/lib"
"-DGRPC_ROOT=${grpc}"
# Manually define CMAKE_INSTALL_<DIR>
# See: https://github.com/NixOS/nixpkgs/pull/197838
"-DCMAKE_INSTALL_BINDIR=bin"
"-DCMAKE_INSTALL_LIBDIR=lib"
"-DCMAKE_INSTALL_INCLUDEDIR=include"
"-DCMAKE_INSTALL_LIBEXECDIR=libexec"
"-DCMAKE_INSTALL_DOCDIR=doc"
]
++ lib.optionals buildTests [
"-DBUILD_TESTS=ON"
];
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace-fail "file(STRINGS /etc/os-release LINUX_DISTRO LIMIT_COUNT 1 REGEX \"NAME=\")" "set(LINUX_DISTRO \"NixOS\")"
'';
postInstall = ''
find $out/bin -executable -type f -exec \
patchelf {} --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" \;
''
+ lib.optionalString buildTests ''
mkdir -p $test
mv $out/bin/rdctst_tests $test/bin
'';
passthru.updateScript = rocmUpdateScript { inherit finalAttrs; };
meta = {
description = "Simplifies administration and addresses infrastructure challenges in cluster and datacenter environments";
homepage = "https://github.com/ROCm/rocm-systems/tree/develop/projects/rdc";
license = with lib.licenses; [ mit ];
teams = [ lib.teams.rocm ];
platforms = lib.platforms.linux;
};
})
|