28 stdenv.mkDerivation rec {
32 src = fetchFromGitHub {
36 sha256 = "sha256-77X+AvHFWfYYIio3c+EYf11jg/1IbYhNUweRIDHMOZw=";
42 url = "https://patch-diff.githubusercontent.com/raw/TigerVNC/tigervnc/pull/1383.patch";
43 sha256 = "sha256-r3QLtxVD0wIv2NWVN9r0LVxSlLurDHgkAZfkpIjmZyU=";
44 name = "Xvnc-support-Xorg-1.21-PR1383.patch";
48 postPatch = lib.optionalString stdenv.isLinux ''
49 sed -i -e '/^\$cmd \.= " -pn";/a$cmd .= " -xkbdir ${xkeyboard_config}/etc/X11/xkb";' unix/vncserver/vncserver.in
51 substituteInPlace vncviewer/vncviewer.cxx \
52 --replace '"/usr/bin/ssh' '"${openssh}/bin/ssh'
54 cp unix/xserver21.1.1.patch unix/xserver211.patch
57 # On Mac, do not build a .dmg, instead copy the .app to the source dir
58 gawk -i inplace 'BEGIN { del=0 } /hdiutil/ { del=2 } del<=0 { print } /$VERSION.dmg/ { del -= 1 }' release/makemacapp.in
59 echo "mv \"\$APPROOT\" \"\$SRCDIR/\"" >> release/makemacapp.in
62 dontUseCmakeBuildDir = true;
65 "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
66 "-DCMAKE_INSTALL_SBINDIR=${placeholder "out"}/bin"
67 "-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "out"}/bin"
70 postBuild = lib.optionalString stdenv.isLinux ''
71 export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -Wno-error=int-to-pointer-cast -Wno-error=pointer-to-int-cast"
72 export CXXFLAGS="$CXXFLAGS -fpermissive"
74 tar xf ${xorg.xorgserver.src}
75 cp -R xorg*/* unix/xserver
77 version=$(echo ${xorg.xorgserver.name} | sed 's/.*-\([0-9]\+\).\([0-9]\+\).*/\1\2/g')
78 patch -p1 < "$source_top/unix/xserver$version.patch"
80 ./configure $configureFlags --disable-devel-docs --disable-docs \
81 --disable-xorg --disable-xnest --disable-xvfb --disable-dmx \
82 --disable-xwin --disable-xephyr --disable-kdrive --with-pic \
83 --disable-xorgcfg --disable-xprint --disable-static \
84 --enable-composite --disable-xtrap --enable-xcsecurity \
87 --disable-config-dbus --disable-config-udev --disable-config-hal \
89 --disable-dri --disable-dri2 --disable-dri3 --enable-glx \
90 --enable-install-libxf86config \
91 --prefix="$out" --disable-unit-tests \
92 --with-xkb-path=${xkeyboard_config}/share/X11/xkb \
93 --with-xkb-bin-directory=${xorg.xkbcomp}/bin \
94 --with-xkb-output=$out/share/X11/xkb/compiled
95 make TIGERVNC_SRC=$src TIGERVNC_BUILDDIR=`pwd`/../.. -j$NIX_BUILD_CORES
97 '' + lib.optionalString stdenv.isDarwin ''
101 postInstall = lib.optionalString stdenv.isLinux ''
102 pushd unix/xserver/hw/vnc
103 make TIGERVNC_SRC=$src TIGERVNC_BUILDDIR=`pwd`/../../../.. install
105 rm -f $out/lib/xorg/protocol.txt
107 wrapProgram $out/bin/vncserver \
108 --prefix PATH : ${lib.makeBinPath (with xorg; [ xterm twm xsetroot xauth ]) }
109 '' + lib.optionalString stdenv.isDarwin ''
110 mkdir -p $out/Applications
111 mv 'TigerVNC Viewer ${version}.app' $out/Applications/
112 rm $out/bin/vncviewer
113 echo "#!/usr/bin/env bash
114 open $out/Applications/TigerVNC\ Viewer\ ${version}.app --args \$@" >> $out/bin/vncviewer
115 chmod +x $out/bin/vncviewer
124 ] ++ lib.optionals stdenv.isLinux (with xorg; [
142 ] ++ xorg.xorgserver.buildInputs
145 nativeBuildInputs = [
148 ] ++ lib.optionals stdenv.isLinux (with xorg; [
154 ] ++ xorg.xorgserver.nativeBuildInputs);
156 propagatedBuildInputs = lib.optional stdenv.isLinux xorg.xorgserver.propagatedBuildInputs;
158 passthru.tests.tigervnc = nixosTests.vnc.testTigerVNC;
161 homepage = "https://tigervnc.org/";
162 license = lib.licenses.gpl2Plus;
163 description = "Fork of tightVNC, made in cooperation with VirtualGL";
164 maintainers = with lib.maintainers; [viric];
165 platforms = lib.platforms.unix;
166 # Prevent a store collision.