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