Nvidia with version

This commit is contained in:
Guillaume Bouchard 2018-02-19 16:30:03 +01:00
parent 335ce768c7
commit 52149c5780
2 changed files with 53 additions and 25 deletions

View File

@ -28,21 +28,52 @@ Clone this git repository:
``` ```
git clone https://github.com/guibou/nixGL git clone https://github.com/guibou/nixGL
```
Build / install
```
cd nixGL cd nixGL
nix-build -A XXX ```
## Optional (if NVIDIA) Grab your NVIDIA driver version
Using `glxinfo` from your host system, grab the driver version, here `390.25`:
```
$ glxinfo | grep NVIDIA
...
OpenGL core profile version string: 4.5.0 NVIDIA 390.25
...
```
## Build
For intel:
```
nix-build -A nixGLIntel
```
For NVIDIA alone:
```
nix-build -A nixGLNvidia --argstr nvidiaVersion 390.25
```
(replace `390.25` with the host driver version gathered earlier.)
For Nvidia with bumblebee:
```
nix-build -A nixGLNvidiaBumblebee --argstr nvidiaVersion 390.25
```
(replace `390.25` with the host driver version gathered earlier.)
## Install
```
nix-env -i ./result nix-env -i ./result
``` ```
XXX can be one of: (Note, you can iterate many time on this process to install as many driver as needed. Common example are `nixGLIntel` with `nixGLNvidiaBumblebee`)
- `nixGLNvidia`: Nvidia driver without bumblebee
- `nixGLNvidiaBumblebee`: Nvidia driver with bumblebee
- `nixGLIntel`: Intel driver
# Usage # Usage
@ -61,15 +92,4 @@ OpenGL version string: 4.6.0 NVIDIA 390.25
# Limitations # Limitations
The idea is really simple and should work reliably in most cases. It Does not work now for AMD drivers because I dont' have the hardware.
can be easily extended to AMD drivers, I just don't have the hardware
to test. Contact me.
*Important*: You need an host system driver which match the nixpkgs one. For example, at the time of this writing, nixpkgs contains nvidia `390.25`. Your host system must contain the same version. This limitation can be lifted by using a different version of nixpkgs:
```shell
export NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixos-14.12.tar.gz
nix-build -A nixGLNvidia
```
Contact me if this limitation is too important, it may be easy to automate this process.

View File

@ -1,4 +1,6 @@
{ system ? builtins.currentSystem }: { system ? builtins.currentSystem,
nvidiaVersion ? null
}:
let let
pkgs = import <nixpkgs> { inherit system; }; pkgs = import <nixpkgs> { inherit system; };
@ -7,10 +9,16 @@ let
in in
with pkgs; with pkgs;
rec { rec {
nvidiaLibsOnly = linuxPackages.nvidia_x11.override { nvidiaLibsOnly = (linuxPackages.nvidia_x11.override {
libsOnly = true; libsOnly = true;
kernel = null; kernel = null;
}; }).overrideAttrs(oldAttrs: rec {
name = "nvidia-${nvidiaVersion}";
src = fetchurl {
url = "http://download.nvidia.com/XFree86/Linux-x86_64/${nvidiaVersion}/NVIDIA-Linux-x86_64-${nvidiaVersion}.run";
sha256 = null;
};
});
nixGLNvidiaBumblebee = runCommand "nixGLNvidiaBumblebee-${version}" { nixGLNvidiaBumblebee = runCommand "nixGLNvidiaBumblebee-${version}" {
buildInputs = [ libglvnd nvidiaLibsOnly bumblebee ]; buildInputs = [ libglvnd nvidiaLibsOnly bumblebee ];