nixGL/nvidiaInstall.py
Guillaume Bouchard d78549fef3 Create a wrapper for nvidia install
Hash of nvidia driver is not known because it depends on the driver version
(argument `nvidiaVersion`). However, since nix 2.0 and when using `useSandbox`,
`sha256 = null` is not allowed anymore.

The new wrapper script, `nvidiaInstall.py` uses `nix-prefetch-url` to compute
the hash and call `nix`.

This is a fix for #9
2018-05-19 21:37:45 +02:00

14 lines
469 B
Python
Executable File

#! /usr/bin/env nix-shell
#! nix-shell -i python3 -p python3
import sys
import subprocess
nvidiaVersion = sys.argv[1]
tool = sys.argv[2]
nvidiaUrl = f"http://download.nvidia.com/XFree86/Linux-x86_64/{nvidiaVersion}/NVIDIA-Linux-x86_64-{nvidiaVersion}.run"
nvidiaHash = subprocess.check_output(["nix-prefetch-url", nvidiaUrl]).strip()
subprocess.check_call(["nix-build", "-A", tool, "--argstr", "nvidiaVersion", nvidiaVersion, "--argstr", "nvidiaHash", nvidiaHash])