1diff --git a/python/triton/runtime/build.py b/python/triton/runtime/build.py
2index 1b76548d4..2756dccdb 100644
3--- a/python/triton/runtime/build.py
4+++ b/python/triton/runtime/build.py
5@@ -33,5 +33,13 @@ def _build(name, src, srcdir, library_dirs, include_dirs, libraries):
6 cc_cmd += [f'-l{lib}' for lib in libraries]
7 cc_cmd += [f"-L{dir}" for dir in library_dirs]
8 cc_cmd += [f"-I{dir}" for dir in include_dirs if dir is not None]
9+
10+ # Nixpkgs support branch
11+ # Allows passing e.g. extra -Wl,-rpath
12+ cc_cmd_extra_flags = "@ccCmdExtraFlags@"
13+ if cc_cmd_extra_flags != ("@" + "ccCmdExtraFlags@"): # substituteAll hack
14+ import shlex
15+ cc_cmd.extend(shlex.split(cc_cmd_extra_flags))
16+
17 subprocess.check_call(cc_cmd, stdout=subprocess.DEVNULL)
18 return so