www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 4c099104283fe89d04b6c32a0484093b1a40c6a3
parent 7aa1cce7c6e844cbc2552e47f251c8f2d38ab8f1
Author: zimbatm <zimbatm@zimbatm.com>
Date:   Tue, 28 Apr 2020 16:55:38 +0200

handle nixGLDefault with nvidiaVersionFile

Diffstat:
MnixGL.nix | 19+++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/nixGL.nix b/nixGL.nix @@ -33,7 +33,7 @@ let # Add an impure parameter to force the rebuild on each access. time = builtins.currentTime; } - "cp /proc/driver/nvidia/version $out"; + "cp /proc/driver/nvidia/version $out || touch $out"; # The nvidia version. Either fixed by the `nvidiaVersion` argument, or # auto-detected. Auto-detection is impure. @@ -46,8 +46,10 @@ let data = builtins.readFile _nvidiaVersionFile; versionMatch = builtins.match ".*Module +([0-9]+\\.[0-9]+).*" data; in - assert builtins.length versionMatch == 1; - builtins.head versionMatch; + if versionMatch != null then + builtins.head versionMatch + else + null; addNvidiaVersion = drv: drv.overrideAttrs(oldAttrs: { name = oldAttrs.name + "-${_nvidiaVersion}"; @@ -187,8 +189,9 @@ in # The output derivation contains nixGL which point either to # nixGLNvidia or nixGLIntel using an heuristic. nixGLDefault = - if builtins.pathExists "/proc/driver/nvidia/version" - then nixGLCommon nixGLNvidia - else nixGLCommon nixGLIntel; - - } + if _nvidiaVersion != null then + nixGLCommon nixGLNvidia + else + nixGLCommon nixGLIntel + ; +}