nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 rocmUpdateScript,
6 cmake,
7 rocm-cmake,
8 rocm-runtime,
9 busybox,
10 python3,
11 gnugrep,
12 clr, # Only for localGpuTargets
13 # rocminfo requires that the calling user have a password and be in
14 # the video group. If we let rocm_agent_enumerator rely upon
15 # rocminfo's output, then it, too, has those requirements. Instead,
16 # we can specify the GPU targets for this system (e.g. "gfx803" for
17 # Polaris) such that no system call is needed for downstream
18 # compilers to determine the desired target.
19 defaultTargets ? (clr.localGpuTargets or [ ]),
20}:
21
22stdenv.mkDerivation (finalAttrs: {
23 version = "6.3.3";
24 pname = "rocminfo";
25
26 src = fetchFromGitHub {
27 owner = "ROCm";
28 repo = "rocminfo";
29 rev = "rocm-${finalAttrs.version}";
30 sha256 = "sha256-fQPtO5TNbCbaZZ7VtGkkqng5QZ+FcScdh1opWr5YkLU=";
31 };
32
33 nativeBuildInputs = [
34 cmake
35 rocm-cmake
36 ];
37
38 buildInputs = [ rocm-runtime ];
39 propagatedBuildInputs = [ python3 ];
40 cmakeFlags = [ "-DROCRTST_BLD_TYPE=Release" ];
41
42 prePatch = ''
43 patchShebangs rocm_agent_enumerator
44 sed 's,lsmod | grep ,${busybox}/bin/lsmod | ${gnugrep}/bin/grep ,' -i rocminfo.cc
45 '';
46
47 postInstall = lib.optionalString (defaultTargets != [ ]) ''
48 echo '${lib.concatStringsSep "\n" defaultTargets}' > $out/bin/target.lst
49 '';
50
51 passthru.updateScript = rocmUpdateScript {
52 name = finalAttrs.pname;
53 inherit (finalAttrs.src) owner;
54 inherit (finalAttrs.src) repo;
55 };
56
57 meta = with lib; {
58 description = "ROCm Application for Reporting System Info";
59 homepage = "https://github.com/ROCm/rocminfo";
60 license = licenses.ncsa;
61 maintainers = with maintainers; [ lovesegfault ];
62 teams = [ teams.rocm ];
63 platforms = platforms.linux;
64 };
65})