@@ -25,6 +25,8 @@
2525
2626with stdenv.lib;
2727
28+let system-x86_64 = elem stdenv.system platforms.x86_64; in
29+
2830stdenv.mkDerivation {
2931
3032 name = "qtbase-${version}";
@@ -104,6 +106,7 @@ stdenv.mkDerivation {
104106 -strip
105107 -reduce-relocations
106108 -system-proxies
109+ -pkg-config
107110
108111 -gui
109112 -widgets
@@ -124,6 +127,16 @@ stdenv.mkDerivation {
124127 -no-linuxfb
125128 -no-kms
126129
130+ ${optionalString (!system-x86_64) "-no-sse2"}
131+ -no-sse3
132+ -no-ssse3
133+ -no-sse4.1
134+ -no-sse4.2
135+ -no-avx
136+ -no-avx2
137+ -no-mips_dsp
138+ -no-mips_dspr2
139+
127140 -system-zlib
128141 -system-libpng
129142 -system-libjpeg
@@ -142,6 +155,11 @@ stdenv.mkDerivation {
142155 -${optionalString (buildTests == false) "no"}make tests
143156 '';
144157
158+ # PostgreSQL autodetection fails sporadically because Qt omits the "-lpq" flag
159+ # if dependency paths contain the string "pq", which can occur in the hash.
160+ # To prevent these failures, we need to override PostgreSQL detection.
161+ PSQL_LIBS = optionalString (postgresql != null) "-L${postgresql}/lib -lpq";
162+
145163 propagatedBuildInputs = [
146164 xlibs.libXcomposite libX11 libxcb libXext libXrender libXi
147165 fontconfig freetype openssl dbus.libs glib udev libxml2 libxslt pcre
@@ -171,12 +189,11 @@ stdenv.mkDerivation {
171189
172190 # Don't retain build-time dependencies like gdb and ruby.
173191 sed '/QMAKE_DEFAULT_.*DIRS/ d' -i $out/mkspecs/qconfig.pri
174−
175− mkdir -p "$out/nix-support"
176− substitute ${./setup-hook.sh} "$out/nix-support/setup-hook" \
177− --subst-var out --subst-var-by lndir "${lndir}"
178192 '';
179193
194+ inherit lndir;
195+ setupHook = ./setup-hook.sh;
196+
180197 enableParallelBuilding = true; # often fails on Hydra, as well as qt4
181198
182199 meta = {