blob: 3803928a05daea02b735c16bf19f953a09e9a1d0 (
about) (
plain)
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
|
{
lib,
stdenv,
fetchFromGitHub,
fetchpatch,
rocmUpdateScript,
cmake,
pkg-config,
libdrm,
wrapPython,
autoPatchelfHook,
}:
let
esmi_ib_src = fetchFromGitHub {
owner = "amd";
repo = "esmi_ib_library";
rev = "esmi_pkg_ver-3.0.3";
hash = "sha256-q0w5c5c+CpXkklmSyfzc+sbkt4cHNxscGJA3AXwvHxQ=";
};
in
stdenv.mkDerivation (finalAttrs: {
pname = "amdsmi";
version = "6.3.3";
src = fetchFromGitHub {
owner = "rocm";
repo = "amdsmi";
rev = "rocm-${finalAttrs.version}";
hash = "sha256-hrPqd4ZWqzTG7JRfVwc1SZx6TNS0Q/LFg8yDxrM3mPo=";
};
postPatch = ''
substituteInPlace goamdsmi_shim/CMakeLists.txt \
--replace-fail "amd_smi)" ${"'"}''${AMD_SMI_TARGET})' \
--replace-fail 'target_link_libraries(''${GOAMDSMI_SHIM_TARGET} -L' '#'
# Manually unpack esmi_ib_src and add amd_hsmp.h so execute-process git clone doesn't run
cp -rf --no-preserve=mode ${esmi_ib_src} ./esmi_ib_library
mkdir -p ./esmi_ib_library/include/asm
cp ./include/amd_smi/impl/amd_hsmp.h ./esmi_ib_library/include/asm/amd_hsmp.h
'';
patches = [
# Fix ld.lld undefined reference: drmGetVersion
(fetchpatch {
url = "https://github.com/ROCm/amdsmi/commit/c3864bf6171970d86dc50fd23f06377736823997.patch";
hash = "sha256-zRG1tBD8sIQCWdKfCbXC/Z/6d6NTrRYvRpddPWdM4j8=";
})
];
nativeBuildInputs = [
cmake
pkg-config
wrapPython
autoPatchelfHook
];
buildInputs = [
libdrm
];
cmakeFlags = [
# 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"
];
postInstall = ''
wrapPythonProgramsIn $out
rm $out/bin/amd-smi
ln -sf $out/libexec/amdsmi_cli/amdsmi_cli.py $out/bin/amd-smi
'';
passthru.updateScript = rocmUpdateScript {
name = finalAttrs.pname;
inherit (finalAttrs.src) owner;
inherit (finalAttrs.src) repo;
};
meta = with lib; {
description = "System management interface for AMD GPUs supported by ROCm";
homepage = "https://github.com/ROCm/rocm_smi_lib";
license = with licenses; [ mit ];
maintainers = with maintainers; [ lovesegfault ] ++ teams.rocm.members;
platforms = [ "x86_64-linux" ];
};
})
|