What should rocm path be?

I’m trying to install xformers with ROCm support inside a conda shell. The pre-built packages do not seem to support ROCm, so I’m trying to build xformers from source. I’ve made a bit of progress, but I’m now getting stuck on error messages like this:

      clang++: error: cannot find ROCm device library; provide its path via '--rocm-path' or '--rocm-device-lib-path', or pass '-nogpulib' to build without ROCm device library
      clang++: error: cannot find HIP runtime; provide its path via '--rocm-path', or pass '-nogpuinc' to build without HIP runtime
      clang++: error: cannot find HIP runtime; provide its path via '--rocm-path', or pass '-nogpuinc' to build without HIP runtime

The problem is that all ROCm libraries are usually installed together in /opt/rocm, but Nix obviously doesn’t install the libraries there. I’ve tried setting it to the rocm runtime directory in the store, but then it also expects to find hipcc there, which causes an error like this:

/bin/sh: line 1: /nix/store/637pjyhpg2lyw57pzx7d5jr01f5bxmid-rocm-runtime-5.7.1/bin/hipcc: No such file or directory

What can I do to fix this problem?

Edit: I see the torchWithRocm package sets ROCM_PATH to rocmtoolkit_joined:

But how do I use this myself?

OK, copying that rocm-merged expression into a standalone file:

with import <nixpkgs> {};
symlinkJoin {
    name = "rocm-merged";

    paths = with rocmPackages; [
      rocm-core clr rccl miopen miopengemm rocrand rocblas
      rocsparse hipsparse rocthrust rocprim hipcub roctracer
      rocfft rocsolver hipfft hipsolver hipblas
      rocminfo rocm-thunk rocm-comgr rocm-device-libs
      rocm-runtime clr.icd hipify
    ];

    # Fix `setuptools` not being found
    postBuild = ''
      rm -rf $out/nix-support
    '';
}

And building that gives me a new store path which seems to work as the ROCM_PATH. There are still more errors, but this question is answered.