DSO search: Add escape hatch
We add a -d/--driver-directory flag allowing the user to circomvent the DSO automatic lookup and instead force nix-gl-host to load its dynamic libraries from a specific directory.
This commit is contained in:
parent
d020c8f4fe
commit
8e93fe5dea
|
@ -419,9 +419,6 @@ def exec_binary(bin_path: str, args: List[str]) -> None:
|
|||
Sets the relevant libGLvnd env variables."""
|
||||
log_info(f"Execv-ing {bin_path}")
|
||||
log_info(f"Goodbye now.")
|
||||
# The following two env variables are required by our patched libglvnd
|
||||
# implementation to figure out what kind of driver the host
|
||||
# machine is using.
|
||||
os.execvp(bin_path, [bin_path] + args)
|
||||
|
||||
|
||||
|
@ -432,6 +429,13 @@ def main(args):
|
|||
cache_dir = os.path.join(xdg_cache_home, "nix-gl-host")
|
||||
log_info(f'Using "{cache_dir}" as cache dir.')
|
||||
os.makedirs(cache_dir, exist_ok=True)
|
||||
if args.driver_directory:
|
||||
log_info(
|
||||
f"Retreiving DSOs from the specified directory: {args.driver_directory}"
|
||||
)
|
||||
host_dsos_paths: List[str] = [args.driver_directory]
|
||||
else:
|
||||
log_info("Retrieving DSOs from the load path.")
|
||||
host_dsos_paths: List[str] = get_ld_paths()
|
||||
new_env = nvidia_main(cache_dir, host_dsos_paths)
|
||||
os.environ.update(new_env)
|
||||
|
@ -445,6 +449,13 @@ if __name__ == "__main__":
|
|||
prog="nixglhost-wrapper",
|
||||
description="Wrapper used to massage the host GL drivers to work with your nix-built binary.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-d",
|
||||
"--driver-directory",
|
||||
type=str,
|
||||
help="Use the driver libraries contained in this directory instead of discovering them from the load path.",
|
||||
default=None,
|
||||
)
|
||||
parser.add_argument(
|
||||
"NIX_BINARY",
|
||||
type=str,
|
||||
|
|
Loading…
Reference in New Issue