2021-03-14 06:13:41 +01:00
|
|
|
# Global configuration for the SSH client.
|
|
|
|
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.programs.turbovnc;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
|
|
|
|
programs.turbovnc = {
|
|
|
|
|
2024-04-17 13:37:58 +02:00
|
|
|
ensureHeadlessSoftwareOpenGL = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
2021-03-14 06:13:41 +01:00
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Whether to set up NixOS such that TurboVNC's built-in software OpenGL
|
|
|
|
implementation works.
|
|
|
|
|
2024-06-16 12:50:18 +02:00
|
|
|
This will enable {option}`hardware.graphics.enable` so that OpenGL
|
2021-03-14 06:13:41 +01:00
|
|
|
programs can find Mesa's llvmpipe drivers.
|
|
|
|
|
|
|
|
Setting this option to `false` does not mean that software
|
|
|
|
OpenGL won't work; it may still work depending on your system
|
|
|
|
configuration.
|
|
|
|
|
|
|
|
This option is also intended to generate warnings if you are using some
|
|
|
|
configuration that's incompatible with using headless software OpenGL
|
|
|
|
in TurboVNC.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2024-04-17 13:37:58 +02:00
|
|
|
config = lib.mkIf cfg.ensureHeadlessSoftwareOpenGL {
|
2021-03-14 06:13:41 +01:00
|
|
|
|
|
|
|
# TurboVNC has builtin support for Mesa llvmpipe's `swrast`
|
2023-05-20 04:11:38 +02:00
|
|
|
# software rendering to implement GLX (OpenGL on Xorg).
|
2021-03-14 06:13:41 +01:00
|
|
|
# However, just building TurboVNC with support for that is not enough
|
|
|
|
# (it only takes care of the X server side part of OpenGL);
|
|
|
|
# the indiviudual applications (e.g. `glxgears`) also need to directly load
|
|
|
|
# the OpenGL libs.
|
|
|
|
# Thus, this creates `/run/opengl-driver` populated by Mesa so that the applications
|
|
|
|
# can find the llvmpipe `swrast.so` software rendering DRI lib via `libglvnd`.
|
|
|
|
# This comment exists to explain why `hardware.` is involved,
|
|
|
|
# even though 100% software rendering is used.
|
2024-06-16 12:50:18 +02:00
|
|
|
hardware.graphics.enable = true;
|
2021-03-14 06:13:41 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
}
|