File tree 2 files changed +46
-0
lines changed
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 13
13
enable32bits = isIntelX86Platform ;
14
14
enableIntelX86Extensions = isIntelX86Platform ;
15
15
} ;
16
+
16
17
in rec {
17
18
18
19
packages = {
39
40
pkgs = final ;
40
41
enable32bits = isIntelX86Platform ;
41
42
enableIntelX86Extensions = isIntelX86Platform ;
43
+ } // {
44
+ nixGLDynamic = final . callPackage ./dynamicWrapper.nix { } ;
42
45
} ;
43
46
} ;
44
47
} ;
You can’t perform that action at this time.
0 commit comments