2021-03-09 03:18:52 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2021-03-19 17:17:44 +00:00
|
|
|
, nixosTests
|
2021-03-09 03:18:52 +00:00
|
|
|
|
|
|
|
# Dependencies
|
2022-06-16 17:23:12 +00:00
|
|
|
, bzip2
|
2021-03-09 03:18:52 +00:00
|
|
|
, cmake
|
2022-06-16 17:23:12 +00:00
|
|
|
, freetype
|
|
|
|
, libGL
|
2021-03-09 03:18:52 +00:00
|
|
|
, libjpeg_turbo
|
|
|
|
, makeWrapper
|
|
|
|
, mesa # for built-in 3D software rendering using swrast
|
|
|
|
, openjdk # for the client with Java GUI
|
|
|
|
, openjdk_headless # for the server
|
|
|
|
, openssh
|
|
|
|
, openssl
|
|
|
|
, pam
|
|
|
|
, perl
|
2023-07-15 17:15:38 +00:00
|
|
|
, pkg-config
|
2022-06-16 17:23:12 +00:00
|
|
|
, python3
|
2021-03-09 03:18:52 +00:00
|
|
|
, which
|
|
|
|
, xkbcomp
|
|
|
|
, xkeyboard_config
|
|
|
|
, xorg
|
2022-06-16 17:23:12 +00:00
|
|
|
, xterm
|
|
|
|
, zlib
|
2021-03-09 03:18:52 +00:00
|
|
|
}:
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2021-03-09 03:18:52 +00:00
|
|
|
pname = "turbovnc";
|
2023-07-15 17:15:38 +00:00
|
|
|
version = "3.0.3";
|
2021-03-09 03:18:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "TurboVNC";
|
|
|
|
repo = "turbovnc";
|
2023-07-15 17:15:38 +00:00
|
|
|
rev = finalAttrs.version;
|
|
|
|
hash = "sha256-akkkbDb5ZHTG5GEEeDm1ns60GedQ+DnFXgVMZumRQHc=";
|
2021-03-09 03:18:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# TODO:
|
|
|
|
# * Build outputs that are unclear:
|
|
|
|
# * `-- FONT_ENCODINGS_DIRECTORY = /var/empty/share/X11/fonts/encodings`
|
|
|
|
# Maybe relevant what the tigervnc and tightvnc derivations
|
|
|
|
# do with their `fontDirectories`?
|
2023-07-15 17:15:38 +00:00
|
|
|
# * `XORG_REGISTRY_PATH = /var/empty/lib64/xorg`
|
2021-03-09 03:18:52 +00:00
|
|
|
# * The thing about xorg `protocol.txt`
|
|
|
|
# * Does SSH support require `openssh` on PATH?
|
|
|
|
# * Add `enableClient ? true` flag that disables the client GUI
|
|
|
|
# so that the server can be built without openjdk dependency.
|
|
|
|
# * Perhaps allow to build the client on non-Linux platforms.
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
makeWrapper
|
|
|
|
openjdk_headless
|
2023-07-15 17:15:38 +00:00
|
|
|
pkg-config
|
2022-06-16 17:23:12 +00:00
|
|
|
python3
|
2021-03-09 03:18:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2022-06-16 17:23:12 +00:00
|
|
|
bzip2
|
|
|
|
freetype
|
|
|
|
libGL # for -DTVNC_SYSTEMX11=1
|
2021-03-09 03:18:52 +00:00
|
|
|
libjpeg_turbo
|
|
|
|
openssl
|
|
|
|
pam
|
|
|
|
perl
|
2022-06-16 17:23:12 +00:00
|
|
|
zlib
|
2021-03-09 03:18:52 +00:00
|
|
|
] ++ (with xorg; [
|
2022-06-16 17:23:12 +00:00
|
|
|
libfontenc # for -DTVNC_SYSTEMX11=1
|
2021-03-09 03:18:52 +00:00
|
|
|
libSM
|
|
|
|
libX11
|
2022-06-16 17:23:12 +00:00
|
|
|
libXdamage # for -DTVNC_SYSTEMX11=1
|
|
|
|
libXdmcp # for -DTVNC_SYSTEMX11=1
|
2021-03-09 03:18:52 +00:00
|
|
|
libXext
|
2022-06-16 17:23:12 +00:00
|
|
|
libXfont2 # for -DTVNC_SYSTEMX11=1
|
|
|
|
libxkbfile # for -DTVNC_SYSTEMX11=1
|
2021-03-09 03:18:52 +00:00
|
|
|
libXi
|
2022-06-16 17:23:12 +00:00
|
|
|
mesa # for -DTVNC_SYSTEMX11=1
|
|
|
|
pixman # for -DTVNC_SYSTEMX11=1
|
2021-03-09 03:18:52 +00:00
|
|
|
xorgproto
|
2022-06-16 17:23:12 +00:00
|
|
|
xtrans # for -DTVNC_SYSTEMX11=1
|
2021-03-09 03:18:52 +00:00
|
|
|
]);
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace unix/Xvnc/CMakeLists.txt --replace 'string(REGEX REPLACE "X11" "Xfont2" X11_Xfont2_LIB' 'set(X11_Xfont2_LIB ${xorg.libXfont2}/lib/libXfont2.so) #'
|
|
|
|
substituteInPlace unix/Xvnc/CMakeLists.txt --replace 'string(REGEX REPLACE "X11" "fontenc" X11_Fontenc_LIB' 'set(X11_Fontenc_LIB ${xorg.libfontenc}/lib/libfontenc.so) #'
|
|
|
|
substituteInPlace unix/Xvnc/CMakeLists.txt --replace 'string(REGEX REPLACE "X11" "pixman-1" X11_Pixman_LIB' 'set(X11_Pixman_LIB ${xorg.pixman}/lib/libpixman-1.so) #'
|
|
|
|
'';
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
# For the 3D software rendering built into TurboVNC, pass the path
|
|
|
|
# to the swrast dri driver in Mesa.
|
|
|
|
# Can also be given at runtime to its `Xvnc` as:
|
|
|
|
# -dridir /nix/store/...-mesa-20.1.10-drivers/lib/dri/
|
2023-07-15 17:15:38 +00:00
|
|
|
"-DXORG_DRI_DRIVER_PATH=${mesa.drivers}/lib/dri"
|
2021-03-09 03:18:52 +00:00
|
|
|
# The build system doesn't find these files automatically.
|
|
|
|
"-DTJPEG_JAR=${libjpeg_turbo.out}/share/java/turbojpeg.jar"
|
|
|
|
"-DTJPEG_JNILIBRARY=${libjpeg_turbo.out}/lib/libturbojpeg.so"
|
|
|
|
"-DXKB_BASE_DIRECTORY=${xkeyboard_config}/share/X11/xkb"
|
|
|
|
"-DXKB_BIN_DIRECTORY=${xkbcomp}/bin"
|
2022-06-16 17:23:12 +00:00
|
|
|
# use system libs
|
|
|
|
"-DTVNC_SYSTEMLIBS=1"
|
|
|
|
"-DTVNC_SYSTEMX11=1"
|
|
|
|
"-DTVNC_DLOPENSSL=0"
|
2021-03-09 03:18:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
# turbovnc dlopen()s libssl.so depending on the requested encryption.
|
|
|
|
wrapProgram $out/bin/Xvnc \
|
|
|
|
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ openssl ]}
|
|
|
|
|
|
|
|
# `twm` is the default window manager that `vncserver` tries to start,
|
|
|
|
# and it has minimal dependencies (no non-Xorg).
|
|
|
|
# (This default is written by `vncserver` to `~/.vnc/xstartup.turbovnc`,
|
|
|
|
# see https://github.com/TurboVNC/turbovnc/blob/ffdb57d9/unix/vncserver.in#L201.)
|
|
|
|
# It checks for it using `which twm`.
|
2022-06-16 17:23:12 +00:00
|
|
|
# vncserver needs also needs `xauth` and we add in `xterm` for convenience
|
2021-03-09 03:18:52 +00:00
|
|
|
wrapProgram $out/bin/vncserver \
|
2022-06-16 17:23:12 +00:00
|
|
|
--prefix PATH : ${lib.makeBinPath [ which xorg.twm xorg.xauth xterm ]}
|
2021-03-09 03:18:52 +00:00
|
|
|
|
|
|
|
# Patch /usr/bin/perl
|
|
|
|
patchShebangs $out/bin/vncserver
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
# The viewer is in Java and requires `JAVA_HOME` (which is a single
|
|
|
|
# path, cannot be multiple separated paths).
|
2021-03-09 03:18:52 +00:00
|
|
|
# For SSH support, `ssh` is required on `PATH`.
|
|
|
|
wrapProgram $out/bin/vncviewer \
|
2021-07-14 22:03:04 +00:00
|
|
|
--set JAVA_HOME "${lib.makeLibraryPath [ openjdk ]}/openjdk" \
|
2021-03-09 03:18:52 +00:00
|
|
|
--prefix PATH : ${lib.makeBinPath [ openssh ]}
|
|
|
|
'';
|
|
|
|
|
2021-03-19 17:17:44 +00:00
|
|
|
passthru.tests.turbovnc-headless-server = nixosTests.turbovnc-headless-server;
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
meta = {
|
|
|
|
homepage = "https://turbovnc.org/";
|
|
|
|
license = lib.licenses.gpl2Plus;
|
|
|
|
description = "High-speed version of VNC derived from TightVNC";
|
|
|
|
maintainers = with lib.maintainers; [ nh2 ];
|
|
|
|
platforms = with lib.platforms; linux;
|
2023-07-15 17:15:38 +00:00
|
|
|
changelog = "https://github.com/TurboVNC/turbovnc/blob/${finalAttrs.version}/ChangeLog.md";
|
2021-03-09 03:18:52 +00:00
|
|
|
};
|
2023-07-15 17:15:38 +00:00
|
|
|
})
|