commit 52149c57804a75326c99c36df56cf63601112d45
parent 335ce768c741737e91c3ce08e6dd2d3fcb7d0cd6
Author: Guillaume Bouchard <guillaum.bouchard@gmail.com>
Date: Mon, 19 Feb 2018 16:30:03 +0100
Nvidia with version
Diffstat:
| M | README.md | | | 59 | +++++++++++++++++++++++++++++++++++++++-------------------- |
| M | default.nix | | | 14 | +++++++++++--- |
2 files changed, 50 insertions(+), 23 deletions(-)
diff --git a/README.md b/README.md
@@ -28,21 +28,52 @@ Clone this git repository:
```
git clone https://github.com/guibou/nixGL
+cd nixGL
```
-Build / install
+## 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
```
-cd nixGL
-nix-build -A XXX
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
@@ -61,15 +92,4 @@ OpenGL version string: 4.6.0 NVIDIA 390.25
# Limitations
-The idea is really simple and should work reliably in most cases. It
-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.
-\ No newline at end of file
+Does not work now for AMD drivers because I dont' have the hardware.
diff --git a/default.nix b/default.nix
@@ -1,4 +1,6 @@
-{ system ? builtins.currentSystem }:
+{ system ? builtins.currentSystem,
+ nvidiaVersion ? null
+}:
let
pkgs = import <nixpkgs> { inherit system; };
@@ -7,10 +9,16 @@ let
in
with pkgs;
rec {
- nvidiaLibsOnly = linuxPackages.nvidia_x11.override {
+ nvidiaLibsOnly = (linuxPackages.nvidia_x11.override {
libsOnly = true;
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}" {
buildInputs = [ libglvnd nvidiaLibsOnly bumblebee ];