27 stdenv.mkDerivation rec {
31 src = fetchFromGitHub {
35 sha256 = "sha256-TgVV/4MRsQHYKpDf9L5eHMLVpdwvNy1KPDIe7xMlQ9o=";
40 name = "vncauth-security-type.patch";
41 url = "https://github.com/TigerVNC/tigervnc/commit/4f6a3521874da5a67fd746389cfa9b6199eb3582.diff";
42 hash = "sha256-lSkR8e+jsBwkQUJZmA0tb8nM5iSbYtO8uVXtgk5wdF8=";
47 lib.optionalString stdenv.hostPlatform.isLinux ''
48 sed -i -e '/^\$cmd \.= " -pn";/a$cmd .= " -xkbdir ${xkeyboard_config}/etc/X11/xkb";' unix/vncserver/vncserver.in
50 substituteInPlace vncviewer/vncviewer.cxx \
51 --replace '"/usr/bin/ssh' '"${openssh}/bin/ssh'
55 # On Mac, do not build a .dmg, instead copy the .app to the source dir
56 gawk -i inplace 'BEGIN { del=0 } /hdiutil/ { del=2 } del<=0 { print } /$VERSION.dmg/ { del -= 1 }' release/makemacapp.in
57 echo "mv \"\$APPROOT\" \"\$SRCDIR/\"" >> release/makemacapp.in
60 dontUseCmakeBuildDir = true;
63 "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
64 "-DCMAKE_INSTALL_SBINDIR=${placeholder "out"}/bin"
65 "-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "out"}/bin"
68 env.NIX_CFLAGS_COMPILE = toString [
69 "-Wno-error=array-bounds"
73 lib.optionalString stdenv.hostPlatform.isLinux ''
74 export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -Wno-error=int-to-pointer-cast -Wno-error=pointer-to-int-cast"
75 export CXXFLAGS="$CXXFLAGS -fpermissive"
77 tar xf ${xorg.xorgserver.src}
78 cp -R xorg*/* unix/xserver
80 version=$(echo ${xorg.xorgserver.name} | sed 's/.*-\([0-9]\+\).[0-9]\+.*/\1/g')
81 patch -p1 < "$source_top/unix/xserver$version.patch"
83 ./configure $configureFlags --disable-devel-docs --disable-docs \
84 --disable-xorg --disable-xnest --disable-xvfb --disable-dmx \
85 --disable-xwin --disable-xephyr --disable-kdrive --with-pic \
86 --disable-xorgcfg --disable-xprint --disable-static \
87 --enable-composite --disable-xtrap --enable-xcsecurity \
90 --disable-config-dbus --disable-config-udev --disable-config-hal \
92 --disable-dri --disable-dri2 --disable-dri3 --enable-glx \
93 --enable-install-libxf86config \
94 --prefix="$out" --disable-unit-tests \
95 --with-xkb-path=${xkeyboard_config}/share/X11/xkb \
96 --with-xkb-bin-directory=${xorg.xkbcomp}/bin \
97 --with-xkb-output=$out/share/X11/xkb/compiled
98 make TIGERVNC_SRC=$src TIGERVNC_BUILDDIR=`pwd`/../.. -j$NIX_BUILD_CORES
101 + lib.optionalString stdenv.hostPlatform.isDarwin ''
106 lib.optionalString stdenv.hostPlatform.isLinux ''
107 pushd unix/xserver/hw/vnc
108 make TIGERVNC_SRC=$src TIGERVNC_BUILDDIR=`pwd`/../../../.. install
110 rm -f $out/lib/xorg/protocol.txt
112 wrapProgram $out/bin/vncserver \
125 + lib.optionalString stdenv.hostPlatform.isDarwin ''
126 mkdir -p $out/Applications
127 mv 'TigerVNC Viewer ${version}.app' $out/Applications/
128 rm $out/bin/vncviewer
129 echo "#!/usr/bin/env bash
130 open $out/Applications/TigerVNC\ Viewer\ ${version}.app --args \$@" >> $out/bin/vncviewer
131 chmod +x $out/bin/vncviewer
142 ++ lib.optionals stdenv.hostPlatform.isLinux (
165 ++ xorg.xorgserver.buildInputs
173 ++ lib.optionals stdenv.hostPlatform.isLinux (
182 ++ xorg.xorgserver.nativeBuildInputs
185 propagatedBuildInputs = lib.optional stdenv.hostPlatform.isLinux xorg.xorgserver.propagatedBuildInputs;
187 passthru.tests.tigervnc = nixosTests.tigervnc;
190 homepage = "https://tigervnc.org/";
191 license = lib.licenses.gpl2Plus;
192 description = "Fork of tightVNC, made in cooperation with VirtualGL";
194 platforms = lib.platforms.unix;
195 # Prevent a store collision.