File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ {
2+ pkgs ,
3+ writeTextFile ,
4+ runtimeShell ,
5+ gnugrep ,
6+ gnused ,
7+ shellcheck ,
8+ pcre
9+ } :
10+
11+ writeTextFile rec {
12+ name = "nixGL" ;
13+ text = ''#!${ runtimeShell }
14+
15+ driver_file=/proc/driver/nvidia/version
16+
17+ vers=$(${ gnugrep } /bin/grep "Module" "$driver_file" |\
18+ ${ gnused } /bin/sed -E "s/.*Module ([0-9.]+) .*/\1/")
19+ if [ -z "$vers" ]; then
20+ echo "Failed to parse your driver version from $driver_file. Does $driver_file exist?"
21+ echo "Consider using nixGLNvidia-<version> directly instead."
22+ exit 1
23+ fi
24+
25+ if ! command -v nixGLNvidia-"$vers" &> /dev/null; then
26+ echo "nixGLNvidia wrapper not found for $vers"
27+ exit 1
28+ fi
29+
30+ exec nixGLNvidia-"$vers" "$@"
31+ '' ;
32+ executable = true ;
33+ destination = "/bin/${ name } " ;
34+ checkPhase = ''
35+ ${ shellcheck } /bin/shellcheck "$out/bin/${ name } "
36+
37+ # Check that all the files listed in the output binary exists
38+ for i in $(${ pcre } /bin/pcregrep -o0 '/nix/store/.*?/[^ ":]+' $out/bin/${ name } )
39+ do
40+ ls $i > /dev/null || (echo "File $i, referenced in $out/bin/${ name } does not exists."; exit -1)
41+ done
42+ '' ;
43+ }
Original file line number Diff line number Diff line change 1313 enable32bits = isIntelX86Platform ;
1414 enableIntelX86Extensions = isIntelX86Platform ;
1515 } ;
16+
1617 in rec {
1718
1819 packages = {
3940 pkgs = final ;
4041 enable32bits = isIntelX86Platform ;
4142 enableIntelX86Extensions = isIntelX86Platform ;
43+ } // {
44+ nixGLDynamic = final . callPackage ./dynamicWrapper.nix { } ;
4245 } ;
4346 } ;
4447 } ;
You can’t perform that action at this time.
0 commit comments