nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 72 lines 2.0 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 rocmUpdateScript, 6 pkg-config, 7 libdrm, 8 cmake, 9 wrapPython, 10}: 11 12stdenv.mkDerivation (finalAttrs: { 13 pname = "rocm-smi"; 14 version = "7.1.1"; 15 16 src = fetchFromGitHub { 17 owner = "ROCm"; 18 repo = "rocm_smi_lib"; 19 rev = "rocm-${finalAttrs.version}"; 20 hash = "sha256-/3to1+45n+D8snwrFVhApSMWp/rIXmTFK+BiA0mcKZo="; 21 }; 22 23 propagatedBuildInputs = [ 24 libdrm 25 ]; 26 27 nativeBuildInputs = [ 28 cmake 29 wrapPython 30 pkg-config 31 ]; 32 33 cmakeFlags = [ 34 # Manually define CMAKE_INSTALL_<DIR> 35 # See: https://github.com/NixOS/nixpkgs/pull/197838 36 "-DCMAKE_INSTALL_BINDIR=bin" 37 "-DCMAKE_INSTALL_LIBDIR=lib" 38 "-DCMAKE_INSTALL_LIBEXECDIR=libexec" 39 "-DCMAKE_INSTALL_INCLUDEDIR=include" 40 ]; 41 42 postInstall = 43 # wrap python programs, but undo two that need to be importable at that path 44 '' 45 wrapPythonProgramsIn $out 46 mv $out/libexec/rocm_smi/.rsmiBindingsInit.py-wrapped $out/libexec/rocm_smi/rsmiBindingsInit.py 47 mv $out/libexec/rocm_smi/.rsmiBindings.py-wrapped $out/libexec/rocm_smi/rsmiBindings.py 48 '' 49 # workaround: propagate libdrm/ manually 50 # rocm-toolchain doesn't automatically add buildInputs to isystem include path like 51 # wrapper based toolchains, cmake files often don't find_package(rocm-smi) so 52 # can't rely on cmake propagated interface 53 # upstream have been shipping libdrm copied into /opt/rocm 54 + '' 55 ln -s ${libdrm.dev}/include/libdrm/ $out/include/ 56 ''; 57 58 passthru.updateScript = rocmUpdateScript { 59 name = finalAttrs.pname; 60 inherit (finalAttrs.src) owner; 61 inherit (finalAttrs.src) repo; 62 }; 63 64 meta = { 65 description = "System management interface for AMD GPUs supported by ROCm"; 66 homepage = "https://github.com/ROCm/rocm_smi_lib"; 67 license = with lib.licenses; [ mit ]; 68 maintainers = with lib.maintainers; [ lovesegfault ]; 69 teams = [ lib.teams.rocm ]; 70 platforms = [ "x86_64-linux" ]; 71 }; 72})