1# Global configuration for the SSH client.
2
3{
4 config,
5 lib,
6 pkgs,
7 ...
8}:
9
10let
11 cfg = config.programs.turbovnc;
12in
13{
14 options = {
15
16 programs.turbovnc = {
17
18 ensureHeadlessSoftwareOpenGL = lib.mkOption {
19 type = lib.types.bool;
20 default = false;
21 description = ''
22 Whether to set up NixOS such that TurboVNC's built-in software OpenGL
23 implementation works.
24
25 This will enable {option}`hardware.graphics.enable` so that OpenGL
26 programs can find Mesa's llvmpipe drivers.
27
28 Setting this option to `false` does not mean that software
29 OpenGL won't work; it may still work depending on your system
30 configuration.
31
32 This option is also intended to generate warnings if you are using some
33 configuration that's incompatible with using headless software OpenGL
34 in TurboVNC.
35 '';
36 };
37
38 };
39
40 };
41
42 config = lib.mkIf cfg.ensureHeadlessSoftwareOpenGL {
43
44 # TurboVNC has builtin support for Mesa llvmpipe's `swrast`
45 # software rendering to implement GLX (OpenGL on Xorg).
46 # However, just building TurboVNC with support for that is not enough
47 # (it only takes care of the X server side part of OpenGL);
48 # the indiviudual applications (e.g. `glxgears`) also need to directly load
49 # the OpenGL libs.
50 # Thus, this creates `/run/opengl-driver` populated by Mesa so that the applications
51 # can find the llvmpipe `swrast.so` software rendering DRI lib via `libglvnd`.
52 # This comment exists to explain why `hardware.` is involved,
53 # even though 100% software rendering is used.
54 hardware.graphics.enable = true;
55
56 };
57}