nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 rocmUpdateScript,
6 cmake,
7 llvm,
8 zlib,
9 zstd,
10 perl,
11}:
12
13stdenv.mkDerivation (finalAttrs: {
14 pname = "hipify";
15 version = "7.1.1";
16
17 src = fetchFromGitHub {
18 owner = "ROCm";
19 repo = "HIPIFY";
20 rev = "rocm-${finalAttrs.version}";
21 hash = "sha256-NbFFHAAvMGpvIryhEbktN5w03Cpay9lEqelqkUT9dpQ=";
22 };
23
24 strictDeps = true;
25
26 nativeBuildInputs = [
27 cmake
28 perl
29 llvm.rocm-toolchain
30 ];
31
32 buildInputs = [
33 llvm.llvm
34 llvm.clang-unwrapped
35 perl
36 zlib
37 zstd
38 ];
39
40 env.CXXFLAGS = "-I${lib.getInclude llvm.llvm}/include -I${lib.getInclude llvm.clang-unwrapped}/include";
41
42 postPatch = ''
43 substituteInPlace CMakeLists.txt \
44 --replace-fail "\''${LLVM_TOOLS_BINARY_DIR}/clang" "${llvm.rocm-toolchain}/bin/clang"
45 chmod +x bin/*
46 '';
47
48 passthru.updateScript = rocmUpdateScript {
49 name = finalAttrs.pname;
50 inherit (finalAttrs.src) owner;
51 inherit (finalAttrs.src) repo;
52 };
53
54 postInstall = ''
55 rm $out/bin/hipify-perl
56 chmod +x $out/bin/*
57 chmod +x $out/libexec/*
58 patchShebangs $out/bin/
59 patchShebangs $out/libexec/
60 ln -s $out/{libexec/hipify,bin}/hipify-perl
61 '';
62
63 meta = {
64 description = "Convert CUDA to Portable C++ Code";
65 homepage = "https://github.com/ROCm/HIPIFY";
66 license = with lib.licenses; [ mit ];
67 teams = [ lib.teams.rocm ];
68 platforms = lib.platforms.linux;
69 };
70})