summary refs log tree commit diff
path: root/pkgs/applications
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2018-04-11 14:55:52 +0200
committerFrederik Rietdijk <fridh@fridh.nl>2018-04-11 14:55:52 +0200
commitee6894ca1297afe0caf2f389c1f9a9220826b749 (patch)
tree02f96b5744cef8bc55010fb8301f5b50c0748d4c /pkgs/applications
parent392874b9b1411dc7b879997bd8776b921feea61d (diff)
parent617c26df84d5670574864a9ccad0eaf8708bd86a (diff)
downloadnixpkgs-ee6894ca1297afe0caf2f389c1f9a9220826b749.tar
nixpkgs-ee6894ca1297afe0caf2f389c1f9a9220826b749.tar.gz
nixpkgs-ee6894ca1297afe0caf2f389c1f9a9220826b749.tar.bz2
nixpkgs-ee6894ca1297afe0caf2f389c1f9a9220826b749.tar.lz
nixpkgs-ee6894ca1297afe0caf2f389c1f9a9220826b749.tar.xz
nixpkgs-ee6894ca1297afe0caf2f389c1f9a9220826b749.tar.zst
nixpkgs-ee6894ca1297afe0caf2f389c1f9a9220826b749.zip
Merge staging into master
Diffstat (limited to 'pkgs/applications')
-rw-r--r--pkgs/applications/audio/chuck/clang.patch58
-rw-r--r--pkgs/applications/audio/chuck/default.nix19
-rw-r--r--pkgs/applications/audio/fluidsynth/default.nix4
-rw-r--r--pkgs/applications/audio/ncmpc/default.nix2
-rw-r--r--pkgs/applications/display-managers/sddm/default.nix4
-rw-r--r--pkgs/applications/editors/geany/default.nix6
-rw-r--r--pkgs/applications/editors/vim/common.nix4
-rw-r--r--pkgs/applications/gis/grass/default.nix4
-rw-r--r--pkgs/applications/gis/grass/no_symbolic_links.patch37
-rw-r--r--pkgs/applications/gis/qgis/default.nix55
-rw-r--r--pkgs/applications/graphics/fbida/default.nix9
-rw-r--r--pkgs/applications/graphics/gimp/2.8.nix3
-rw-r--r--pkgs/applications/kde/krfb.nix4
-rw-r--r--pkgs/applications/misc/buku/default.nix11
-rw-r--r--pkgs/applications/misc/djvulibre/default.nix6
-rw-r--r--pkgs/applications/misc/girara/default.nix7
-rw-r--r--pkgs/applications/misc/octoprint/default.nix3
-rw-r--r--pkgs/applications/misc/qsyncthingtray/default.nix2
-rw-r--r--pkgs/applications/misc/sdcv/default.nix3
-rw-r--r--pkgs/applications/misc/zathura/core/default.nix7
-rw-r--r--pkgs/applications/networking/irc/irssi/default.nix4
-rw-r--r--pkgs/applications/office/beancount/default.nix44
-rw-r--r--pkgs/applications/office/fava/default.nix4
-rw-r--r--pkgs/applications/version-management/git-and-tools/git/default.nix2
-rw-r--r--pkgs/applications/version-management/gitlab/default.nix6
-rw-r--r--pkgs/applications/version-management/mercurial/default.nix4
-rw-r--r--pkgs/applications/version-management/tortoisehg/default.nix4
-rw-r--r--pkgs/applications/video/kodi/default.nix4
-rw-r--r--pkgs/applications/virtualization/qemu/default.nix40
-rw-r--r--pkgs/applications/virtualization/qemu/riscv.nix5
-rw-r--r--pkgs/applications/window-managers/icewm/default.nix5
-rw-r--r--pkgs/applications/window-managers/icewm/fix-strlcat_strlcpy.patch236
-rw-r--r--pkgs/applications/window-managers/icewm/musl.patch23
-rw-r--r--pkgs/applications/window-managers/weston/default.nix4
34 files changed, 513 insertions, 120 deletions
diff --git a/pkgs/applications/audio/chuck/clang.patch b/pkgs/applications/audio/chuck/clang.patch
new file mode 100644
index 00000000000..77227ef0fd4
--- /dev/null
+++ b/pkgs/applications/audio/chuck/clang.patch
@@ -0,0 +1,58 @@
+diff --git a/src/ugen_osc.cpp b/src/ugen_osc.cpp
+index 6b93c6b..dbefe4f 100644
+--- a/src/ugen_osc.cpp
++++ b/src/ugen_osc.cpp
+@@ -1232,7 +1232,7 @@ CK_DLL_CTRL( gen5_coeffs )
+     Chuck_Array8 * in_args = (Chuck_Array8 *)GET_CK_OBJECT(ARGS);
+     
+     // fprintf(stdout, "calling gen10coeffs, %d\n", weights);
+-    if(in_args<0) return;
++    if(in_args!=0) return;
+     size = in_args->size();
+     if(size >= genX_MAX_COEFFS) size = genX_MAX_COEFFS - 1;
+     
+@@ -1287,7 +1287,7 @@ CK_DLL_CTRL( gen7_coeffs )
+     Chuck_Array8 * in_args = (Chuck_Array8 *)GET_CK_OBJECT(ARGS);
+     
+     // fprintf(stdout, "calling gen10coeffs, %d\n", weights);
+-    if(in_args<0) return;
++    if(in_args!=0) return;
+     size = in_args->size();
+     if(size >= genX_MAX_COEFFS) size = genX_MAX_COEFFS - 1;
+     
+@@ -1340,7 +1340,7 @@ CK_DLL_CTRL( gen9_coeffs )
+     Chuck_Array8 * weights = (Chuck_Array8 *)GET_CK_OBJECT(ARGS);
+     
+     // fprintf(stdout, "calling gen10coeffs, %d\n", weights);
+-    if(weights<0) return;
++    if(weights!=0) return;
+     size = weights->size();
+     if(size >= genX_MAX_COEFFS) size = genX_MAX_COEFFS - 1;
+     
+@@ -1390,7 +1390,7 @@ CK_DLL_CTRL( gen10_coeffs )
+     Chuck_Array8 * weights = (Chuck_Array8 *)GET_CK_OBJECT(ARGS);
+     
+     // fprintf(stdout, "calling gen10coeffs, %d\n", weights);
+-    if(weights<0) return;
++    if(weights!=0) return;
+     size = weights->size();
+     if(size >= genX_MAX_COEFFS) size = genX_MAX_COEFFS - 1;
+     
+@@ -1441,7 +1441,7 @@ CK_DLL_CTRL( gen17_coeffs )
+     Chuck_Array8 * weights = (Chuck_Array8 *)GET_CK_OBJECT(ARGS);
+     
+     // fprintf(stdout, "calling gen17coeffs, %d\n", weights);
+-    if(weights<0) return;
++    if(weights!=0) return;
+     size = weights->size();
+     if(size >= genX_MAX_COEFFS) size = genX_MAX_COEFFS - 1;
+     
+@@ -1502,7 +1502,7 @@ CK_DLL_CTRL( curve_coeffs )
+     Chuck_Array8 * weights = (Chuck_Array8 *)GET_CK_OBJECT(ARGS);
+     
+     // fprintf(stdout, "calling gen17coeffs, %d\n", weights);
+-    if(weights<0) goto done;
++    if(weights!=0) goto done;
+ 
+     nargs = weights->size();
+     if (nargs < 5 || (nargs % 3) != 2)  {   // check number of args
diff --git a/pkgs/applications/audio/chuck/default.nix b/pkgs/applications/audio/chuck/default.nix
index fd7f0c2b07c..e94172b0f87 100644
--- a/pkgs/applications/audio/chuck/default.nix
+++ b/pkgs/applications/audio/chuck/default.nix
@@ -1,4 +1,6 @@
-{ stdenv, fetchurl, alsaLib, bison, flex, libsndfile, which }:
+{ stdenv, fetchurl, alsaLib, bison, flex, libsndfile, which
+, AppKit, Carbon, CoreAudio, CoreMIDI, CoreServices, Kernel
+}:
 
 stdenv.mkDerivation rec {
   version = "1.3.5.2";
@@ -10,19 +12,24 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ bison flex libsndfile which ]
-    ++ stdenv.lib.optional (!stdenv.isDarwin) alsaLib;
+    ++ stdenv.lib.optional (!stdenv.isDarwin) alsaLib
+    ++ stdenv.lib.optional stdenv.isDarwin [ AppKit Carbon CoreAudio CoreMIDI CoreServices Kernel ];
 
-  patches = [ ./darwin-limits.patch ];
+  patches = [ ./clang.patch ./darwin-limits.patch ];
+
+  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-Wno-missing-sysroot";
+  NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-framework MultitouchSupport";
 
   postPatch = ''
     substituteInPlace src/makefile --replace "/usr/bin" "$out/bin"
     substituteInPlace src/makefile.osx --replace "xcodebuild" "/usr/bin/xcodebuild"
     substituteInPlace src/makefile.osx --replace "weak_framework" "framework"
+    substituteInPlace src/makefile.osx --replace "MACOSX_DEPLOYMENT_TARGET=10.5" "MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET"
   '';
 
-  buildPhase =
-    stdenv.lib.optionals stdenv.isLinux  ["make -C src linux-alsa"] ++
-    stdenv.lib.optionals stdenv.isDarwin ["make -C src osx"];
+  buildPhase = ''
+    make -C src ${if stdenv.isDarwin then "osx" else "linux-alsa"}
+  '';
 
   installPhase = ''
     install -Dm755 ./src/chuck $out/bin/chuck
diff --git a/pkgs/applications/audio/fluidsynth/default.nix b/pkgs/applications/audio/fluidsynth/default.nix
index 789ee35f260..27ca539850e 100644
--- a/pkgs/applications/audio/fluidsynth/default.nix
+++ b/pkgs/applications/audio/fluidsynth/default.nix
@@ -5,13 +5,13 @@
 
 stdenv.mkDerivation  rec {
   name = "fluidsynth-${version}";
-  version = "1.1.9";
+  version = "1.1.10";
 
   src = fetchFromGitHub {
     owner = "FluidSynth";
     repo = "fluidsynth";
     rev = "v${version}";
-    sha256 = "0krvmb1idnf95l2ydzfcb08ayyx3n4m71hf9fgwv3srzaikvpf3q";
+    sha256 = "04jlgq1d1hd8r9cnmkl3lgf1fgm7kgy4hh9nfddap41fm1wp121p";
   };
 
   nativeBuildInputs = [ pkgconfig cmake ];
diff --git a/pkgs/applications/audio/ncmpc/default.nix b/pkgs/applications/audio/ncmpc/default.nix
index 5bd2c9045f2..ffd5b9a5858 100644
--- a/pkgs/applications/audio/ncmpc/default.nix
+++ b/pkgs/applications/audio/ncmpc/default.nix
@@ -15,8 +15,6 @@ stdenv.mkDerivation rec {
   buildInputs = [ glib ncurses mpd_clientlib ];
   nativeBuildInputs = [ meson ninja pkgconfig gettext ];
 
-  NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-lintl";
-
   meta = with stdenv.lib; {
     description = "Curses-based interface for MPD (music player daemon)";
     homepage    = https://www.musicpd.org/clients/ncmpc/;
diff --git a/pkgs/applications/display-managers/sddm/default.nix b/pkgs/applications/display-managers/sddm/default.nix
index a7e8799c9c1..a41f917a7ec 100644
--- a/pkgs/applications/display-managers/sddm/default.nix
+++ b/pkgs/applications/display-managers/sddm/default.nix
@@ -22,6 +22,10 @@ in mkDerivation rec {
     # Module Qt5::Test must be included in `find_package` before it is used.
     ''
       sed -i CMakeLists.txt -e '/find_package(Qt5/ s|)| Test)|'
+    ''
+    # Fix missing include for gettimeofday()
+    + ''
+      sed -e '1i#include <sys/time.h>' -i src/helper/HelperApp.cpp
     '';
 
   nativeBuildInputs = [ cmake extra-cmake-modules pkgconfig qttools ];
diff --git a/pkgs/applications/editors/geany/default.nix b/pkgs/applications/editors/geany/default.nix
index 23478758efe..bedc299ee67 100644
--- a/pkgs/applications/editors/geany/default.nix
+++ b/pkgs/applications/editors/geany/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gtk2, which, pkgconfig, intltool, file }:
+{ stdenv, fetchurl, gtk2, which, pkgconfig, intltool, file, libintl }:
 
 with stdenv.lib;
 
@@ -14,9 +14,7 @@ stdenv.mkDerivation rec {
     sha256 = "66baaff43f12caebcf0efec9a5533044dc52837f799c73a1fd7312caa86099c2";
   };
 
-  NIX_LDFLAGS = if stdenv.isDarwin then "-lintl" else null;
-
-  nativeBuildInputs = [ pkgconfig intltool ];
+  nativeBuildInputs = [ pkgconfig intltool libintl ];
   buildInputs = [ gtk2 which file ];
 
   doCheck = true;
diff --git a/pkgs/applications/editors/vim/common.nix b/pkgs/applications/editors/vim/common.nix
index 00b2b23c6f4..5b4f631987f 100644
--- a/pkgs/applications/editors/vim/common.nix
+++ b/pkgs/applications/editors/vim/common.nix
@@ -1,12 +1,12 @@
 { lib, fetchFromGitHub }:
 rec {
-  version = "8.0.1605";
+  version = "8.0.1655";
 
   src = fetchFromGitHub {
     owner = "vim";
     repo = "vim";
     rev = "v${version}";
-    sha256 = "0a8zf43q806py14vq1frm350wycn47cmanj1hn1i7bqx1gdgcal9";
+    sha256 = "1c6raqjaxgsjazn4l7wqg2cscd5i4bz9m2g2xhn9ba1injs7mps1";
   };
 
   enableParallelBuilding = true;
diff --git a/pkgs/applications/gis/grass/default.nix b/pkgs/applications/gis/grass/default.nix
index 987b544c556..8353bce1b84 100644
--- a/pkgs/applications/gis/grass/default.nix
+++ b/pkgs/applications/gis/grass/default.nix
@@ -15,6 +15,10 @@ stdenv.mkDerivation {
   readline ffmpeg makeWrapper wxGTK30 netcdf geos postgresql mysql.connector-c blas ]
     ++ (with python2Packages; [ python dateutil wxPython30 numpy ]);
 
+  # On Darwin the installer tries to symlink the help files into a system
+  # directory
+  patches = [ ./no_symbolic_links.patch ];
+
   configureFlags = [
     "--with-proj-share=${proj}/share/proj"
     "--without-opengl"
diff --git a/pkgs/applications/gis/grass/no_symbolic_links.patch b/pkgs/applications/gis/grass/no_symbolic_links.patch
new file mode 100644
index 00000000000..ef09b97b703
--- /dev/null
+++ b/pkgs/applications/gis/grass/no_symbolic_links.patch
@@ -0,0 +1,37 @@
+diff --git a/include/Make/Install.make b/include/Make/Install.make
+index 0aba138..8ba74bc 100644
+--- a/include/Make/Install.make
++++ b/include/Make/Install.make
+@@ -116,11 +116,6 @@ real-install: | $(INST_DIR) $(UNIX_BIN)
+ 	-$(INSTALL) config.status $(INST_DIR)/config.status
+ 	-$(CHMOD) -R a+rX $(INST_DIR) 2>/dev/null
+ 
+-ifneq ($(findstring darwin,$(ARCH)),)
+-	@# enable OSX Help Viewer
+-	@/bin/ln -sfh "$(INST_DIR)/docs/html" /Library/Documentation/Help/GRASS-$(GRASS_VERSION_MAJOR).$(GRASS_VERSION_MINOR)
+-endif
+-
+ $(INST_DIR) $(UNIX_BIN):
+ 	$(MAKE_DIR_CMD) $@
+ 
+diff --git a/macosx/app/build_html_user_index.sh b/macosx/app/build_html_user_index.sh
+index 04e63eb..c9d9c2c 100755
+--- a/macosx/app/build_html_user_index.sh
++++ b/macosx/app/build_html_user_index.sh
+@@ -140,7 +140,6 @@ else
+ #      echo "<tr><td valign=\"top\"><a href=\"$HTMLDIRG/$i\">$BASENAME</a></td> <td>$SHORTDESC</td></tr>" >> $FULLINDEX
+       # make them local to user to simplify page links
+       echo "<tr><td valign=\"top\"><a href=\"global_$i\">$BASENAME</a></td> <td>$SHORTDESC</td></tr>" >> $FULLINDEX
+-      ln -sf "$HTMLDIRG/$i" global_$i
+     done
+   done
+ fi
+@@ -183,8 +182,3 @@ echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
+ </html>" > $i.html
+ done
+ 
+-# add Help Viewer links in user docs folder
+-
+-mkdir -p $HOME/Library/Documentation/Help/
+-ln -sfh ../../GRASS/$GRASS_MMVER/Modules/docs/html $HOME/Library/Documentation/Help/GRASS-$GRASS_MMVER-addon
+-ln -sfh $GISBASE/docs/html $HOME/Library/Documentation/Help/GRASS-$GRASS_MMVER
diff --git a/pkgs/applications/gis/qgis/default.nix b/pkgs/applications/gis/qgis/default.nix
index 21ee4297599..75f980c6781 100644
--- a/pkgs/applications/gis/qgis/default.nix
+++ b/pkgs/applications/gis/qgis/default.nix
@@ -1,23 +1,31 @@
 { stdenv, fetchurl, fetchpatch, gdal, cmake, qt4, flex, bison, proj, geos, xlibsWrapper, sqlite, gsl
 , qwt, fcgi, python2Packages, libspatialindex, libspatialite, qscintilla, postgresql, makeWrapper
-, qjson, qca2, txt2tags, openssl
-, withGrass ? false, grass
+, qjson, qca2, txt2tags, openssl, darwin, pkgconfig
+, withGrass ? false, grass, IOKit, ApplicationServices
 }:
 
 stdenv.mkDerivation rec {
   name = "qgis-2.18.17";
 
   buildInputs = [ gdal qt4 flex openssl bison proj geos xlibsWrapper sqlite gsl qwt qscintilla
-    fcgi libspatialindex libspatialite postgresql qjson qca2 txt2tags ] ++
+    fcgi libspatialindex libspatialite postgresql qjson qca2 txt2tags pkgconfig ]
+  ++
+    (stdenv.lib.optionals stdenv.isDarwin [IOKit ApplicationServices])
+  ++
     (stdenv.lib.optional withGrass grass) ++
+    (stdenv.lib.optional (stdenv.isDarwin && withGrass) darwin.apple_sdk.libs.utmp) ++
     (with python2Packages; [ jinja2 numpy psycopg2 pygments requests python2Packages.qscintilla sip ]);
 
-  nativeBuildInputs = [ cmake makeWrapper ];
+  nativeBuildInputs = [ cmake makeWrapper pkgconfig ];
 
   # `make -f src/providers/wms/CMakeFiles/wmsprovider_a.dir/build.make src/providers/wms/CMakeFiles/wmsprovider_a.dir/qgswmssourceselect.cpp.o`:
   # fatal error: ui_qgsdelimitedtextsourceselectbase.h: No such file or directory
   enableParallelBuilding = false;
 
+  preConfigure = ''
+    NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE $(pkg-config --cflags libspatialindex)"
+  '';
+
   # To handle the lack of 'local' RPATH; required, as they call one of
   # their built binaries requiring their libs, in the build process.
   preBuild = ''
@@ -29,19 +37,44 @@ stdenv.mkDerivation rec {
     sha256 = "1nxwl5lwibbiz9v3qaw3px7iyxg113zr4j8d99yj07mhk2ap082y";
   };
 
-  cmakeFlags = stdenv.lib.optional withGrass "-DGRASS_PREFIX7=${grass}/${grass.name}";
+  # CMAKE_FIND_FRAMEWORK=never stops the installer choosing system
+  # installed frameworks
+  # QGIS_MACAPP_BUNDLE=0 stops the installer copying the Qt binaries into the
+  # installation which causes havoc
+  # Building RelWithDebInfo allows QGIS_DEBUG to print debugging information
+  cmakeFlags = stdenv.lib.optional withGrass "-DGRASS_PREFIX7=${grass}/${grass.name}"
+               ++ stdenv.lib.optional stdenv.isDarwin
+                    (["-DCMAKE_FIND_FRAMEWORK=never"]
+                      ++ ["-DQGIS_MACAPP_BUNDLE=0"]);
+#                     ++ ["-DCMAKE_BUILD_TYPE=RelWithDebInfo"];
 
-  postInstall = ''
-    wrapProgram $out/bin/qgis \
-      --prefix PYTHONPATH : $PYTHONPATH \
-      --prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ openssl ]}
-  '';
+
+
+  postInstall =
+    (stdenv.lib.optionalString stdenv.isLinux ''
+          wrapProgram $out/bin/qgis \
+            --set PYTHONPATH $PYTHONPATH \
+            --prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ openssl ]}
+          '') +
+    (stdenv.lib.optionalString stdenv.isDarwin ''
+      # Necessary for QGIS to find the correct default GRASS path
+      ${stdenv.lib.optionalString withGrass "ln -sf ${grass} $out/QGIS.app/Contents/MacOS/grass"}
+      for file in $(find $out -type f -name "QGIS"); do
+        wrapProgram "$file" \
+          --prefix DYLD_LIBRARY_PATH : "${qwt}/lib" \
+          --prefix DYLD_LIBRARY_PATH : "${qscintilla}/lib" \
+          ${stdenv.lib.optionalString withGrass "--prefix PATH : ${grass}/bin"} \
+          --set PYTHONPATH $PYTHONPATH
+      done
+      mkdir -p $out/bin
+      ln -s $out/QGIS.app/Contents/MacOS/QGIS $out/bin/qgis
+      '');
 
   meta = {
     description = "User friendly Open Source Geographic Information System";
     homepage = http://www.qgis.org;
     license = stdenv.lib.licenses.gpl2Plus;
-    platforms = with stdenv.lib.platforms; linux;
+    platforms = with stdenv.lib.platforms; unix;
     maintainers = with stdenv.lib.maintainers; [viric];
   };
 }
diff --git a/pkgs/applications/graphics/fbida/default.nix b/pkgs/applications/graphics/fbida/default.nix
index 2943b5ef94c..2e91f787350 100644
--- a/pkgs/applications/graphics/fbida/default.nix
+++ b/pkgs/applications/graphics/fbida/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl, libjpeg, libexif, libungif, libtiff, libpng, libwebp, libdrm
 , pkgconfig, freetype, fontconfig, which, imagemagick, curl, sane-backends, libXpm
-, epoxy, poppler, lirc }:
+, epoxy, poppler, mesa_noglu, lirc }:
 
 stdenv.mkDerivation rec {
   name = "fbida-2.13";
@@ -11,8 +11,11 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ pkgconfig which ];
-  buildInputs = [ libexif libjpeg libpng libungif freetype fontconfig libtiff
-   libwebp imagemagick curl sane-backends libdrm libXpm epoxy poppler lirc ];
+  buildInputs = [
+    libexif libjpeg libpng libungif freetype fontconfig libtiff libwebp
+    imagemagick curl sane-backends libdrm libXpm epoxy poppler lirc
+    mesa_noglu
+  ];
   
   makeFlags = [ "prefix=$(out)" "verbose=yes" "STRIP=" ];
 
diff --git a/pkgs/applications/graphics/gimp/2.8.nix b/pkgs/applications/graphics/gimp/2.8.nix
index a2cbffd5d21..3802fff2ad2 100644
--- a/pkgs/applications/graphics/gimp/2.8.nix
+++ b/pkgs/applications/graphics/gimp/2.8.nix
@@ -46,8 +46,7 @@ in stdenv.mkDerivation rec {
   enableParallelBuilding = true;
 
   # "screenshot" needs this.
-  NIX_LDFLAGS = "-rpath ${xorg.libX11.out}/lib"
-    + stdenv.lib.optionalString stdenv.isDarwin " -lintl";
+  NIX_LDFLAGS = "-rpath ${xorg.libX11.out}/lib";
 
   meta = {
     description = "The GNU Image Manipulation Program";
diff --git a/pkgs/applications/kde/krfb.nix b/pkgs/applications/kde/krfb.nix
index d6de2521533..d2b96bf6100 100644
--- a/pkgs/applications/kde/krfb.nix
+++ b/pkgs/applications/kde/krfb.nix
@@ -1,7 +1,7 @@
 {
   mkDerivation, lib,
   extra-cmake-modules, kdoctools,
-  kdelibs4support, kdnssd, libvncserver, libXtst, qtx11extras
+  kdelibs4support, kdnssd, libvncserver, libXtst, libXdamage, qtx11extras
 }:
 
 mkDerivation {
@@ -11,6 +11,6 @@ mkDerivation {
     maintainers = with lib.maintainers; [ jerith666 ];
   };
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-  buildInputs = [ libvncserver libXtst qtx11extras ];
+  buildInputs = [ libvncserver libXtst libXdamage qtx11extras ];
   propagatedBuildInputs = [ kdelibs4support kdnssd ];
 }
diff --git a/pkgs/applications/misc/buku/default.nix b/pkgs/applications/misc/buku/default.nix
index fb1f6403ce4..83ba02933fd 100644
--- a/pkgs/applications/misc/buku/default.nix
+++ b/pkgs/applications/misc/buku/default.nix
@@ -1,8 +1,8 @@
-{ stdenv, python3, fetchFromGitHub }:
+{ stdenv, python3, fetchFromGitHub, fetchpatch }:
 
 with python3.pkgs; buildPythonApplication rec {
   version = "3.7";
-  name = "buku-${version}";
+  pname = "buku";
 
   src = fetchFromGitHub {
     owner = "jarun";
@@ -11,7 +11,12 @@ with python3.pkgs; buildPythonApplication rec {
     sha256 = "0qc6xkrhf2phaj9fhym19blr4rr2vllvnyljjz909xr4vsynvb41";
   };
 
-  nativeBuildInputs = [
+  patches = fetchpatch {
+    url = https://github.com/jarun/Buku/commit/495d6eac4d9371e8ce6d3f601e2bb9e5e74962b4.patch;
+    sha256 = "0py4l5qcgdzqr0iqmcc8ddld1bspk8iwypz4dcr88y70j86588gk";
+  };
+
+  checkInputs = [
     pytestcov
     pytest-catchlog
     hypothesis
diff --git a/pkgs/applications/misc/djvulibre/default.nix b/pkgs/applications/misc/djvulibre/default.nix
index 6e158f5696c..0b685e04a6f 100644
--- a/pkgs/applications/misc/djvulibre/default.nix
+++ b/pkgs/applications/misc/djvulibre/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libjpeg, libtiff, librsvg, libintlOrEmpty }:
+{ stdenv, fetchurl, libjpeg, libtiff, librsvg, libiconv }:
 
 stdenv.mkDerivation rec {
   name = "djvulibre-3.5.27";
@@ -10,9 +10,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "bin" "dev" "out" ];
 
-  buildInputs = [ libjpeg libtiff librsvg ] ++ libintlOrEmpty;
-
-  NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-lintl";
+  buildInputs = [ libjpeg libtiff librsvg libiconv ];
 
   meta = with stdenv.lib; {
     description = "A library and viewer for the DJVU file format for scanned images";
diff --git a/pkgs/applications/misc/girara/default.nix b/pkgs/applications/misc/girara/default.nix
index 7fd3db860df..184ab818b1c 100644
--- a/pkgs/applications/misc/girara/default.nix
+++ b/pkgs/applications/misc/girara/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, gtk, gettext, ncurses, libiconv, libintlOrEmpty
+{ stdenv, fetchurl, pkgconfig, gtk, gettext, ncurses, libiconv, libintl
 , withBuildColors ? true
 }:
 
@@ -19,10 +19,7 @@ stdenv.mkDerivation rec {
   '';
 
   nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ gtk gettext libintlOrEmpty ]
-    ++ stdenv.lib.optional stdenv.isDarwin libiconv;
-
-  NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-lintl";
+  buildInputs = [ gtk gettext libintl libiconv ];
 
   makeFlags = [
     "PREFIX=$(out)"
diff --git a/pkgs/applications/misc/octoprint/default.nix b/pkgs/applications/misc/octoprint/default.nix
index 6587305a770..ca381e14dd1 100644
--- a/pkgs/applications/misc/octoprint/default.nix
+++ b/pkgs/applications/misc/octoprint/default.nix
@@ -94,6 +94,9 @@ in pythonPackages.buildPythonApplication rec {
       -e 's,pyserial>=[^"]*,pyserial,g' \
       -e 's,semantic_version>=[^"]*,semantic_version,g' \
       -e 's,wrapt>=[^"]*,wrapt,g' \
+      -e 's,python-dateutil>=[^"]*,python-dateutil,g' \
+      -e 's,emoji>=[^"]*,emoji,g' \
+      -e 's,futures>=[^"]*,futures,g' \
       setup.py
   '';
 
diff --git a/pkgs/applications/misc/qsyncthingtray/default.nix b/pkgs/applications/misc/qsyncthingtray/default.nix
index 88628c63c9c..6ae8f380fe2 100644
--- a/pkgs/applications/misc/qsyncthingtray/default.nix
+++ b/pkgs/applications/misc/qsyncthingtray/default.nix
@@ -1,4 +1,4 @@
-{ mkDerivation, stdenv, lib, fetchFromGitHub, fetchpatch, procps ? null
+{ mkDerivation, stdenv, lib, fetchFromGitHub, fetchpatch, procps
 , qtbase, qtwebengine, qtwebkit
 , cmake
 , syncthing
diff --git a/pkgs/applications/misc/sdcv/default.nix b/pkgs/applications/misc/sdcv/default.nix
index 0a8d20a3958..cc8c30043b2 100644
--- a/pkgs/applications/misc/sdcv/default.nix
+++ b/pkgs/applications/misc/sdcv/default.nix
@@ -19,8 +19,7 @@ stdenv.mkDerivation rec {
     mkdir locale
   '';
 
-  NIX_CFLAGS_COMPILE = "-D__GNU_LIBRARY__"
-    + stdenv.lib.optionalString stdenv.isDarwin " -lintl";
+  NIX_CFLAGS_COMPILE = "-D__GNU_LIBRARY__";
 
   meta = with stdenv.lib; {
     homepage = https://dushistov.github.io/sdcv/;
diff --git a/pkgs/applications/misc/zathura/core/default.nix b/pkgs/applications/misc/zathura/core/default.nix
index afb38ace1d9..78d4d69e126 100644
--- a/pkgs/applications/misc/zathura/core/default.nix
+++ b/pkgs/applications/misc/zathura/core/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl, makeWrapper, pkgconfig
 , gtk, girara, ncurses, gettext, docutils
-, file, sqlite, glib, texlive, libintlOrEmpty
+, file, sqlite, glib, texlive, libintl
 , gtk-mac-integration, synctexSupport ? true
 }:
 
@@ -20,8 +20,8 @@ stdenv.mkDerivation rec {
   icon = ./icon.xpm;
 
   nativeBuildInputs = [
-    pkgconfig
-  ] ++ optional stdenv.isDarwin [ libintlOrEmpty ];
+    pkgconfig libintl
+  ];
 
   buildInputs = [
     file gtk girara
@@ -29,7 +29,6 @@ stdenv.mkDerivation rec {
   ] ++ optional synctexSupport texlive.bin.core
     ++ optional stdenv.isDarwin [ gtk-mac-integration ];
 
-  NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-lintl";
   NIX_CFLAGS_COMPILE = "-I${glib.dev}/include/gio-unix-2.0";
 
   makeFlags = [
diff --git a/pkgs/applications/networking/irc/irssi/default.nix b/pkgs/applications/networking/irc/irssi/default.nix
index 97838312fd0..b03673a00b6 100644
--- a/pkgs/applications/networking/irc/irssi/default.nix
+++ b/pkgs/applications/networking/irc/irssi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, ncurses, glib, openssl, perl, libintlOrEmpty }:
+{ stdenv, fetchurl, pkgconfig, ncurses, glib, openssl, perl, libintl }:
 
 stdenv.mkDerivation rec {
   version = "1.1.1";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ ncurses glib openssl perl libintlOrEmpty ];
+  buildInputs = [ ncurses glib openssl perl libintl ];
 
   configureFlags = [
     "--with-proxy"
diff --git a/pkgs/applications/office/beancount/default.nix b/pkgs/applications/office/beancount/default.nix
deleted file mode 100644
index d500be8a1f2..00000000000
--- a/pkgs/applications/office/beancount/default.nix
+++ /dev/null
@@ -1,44 +0,0 @@
-{ stdenv, fetchhg, pkgs, pythonPackages }:
-
-pythonPackages.buildPythonApplication rec {
-  version = "2.0.0";
-  name = "beancount-${version}";
-  namePrefix = "";
-
-  src = pkgs.fetchurl {
-    url = "mirror://pypi/b/beancount/${name}.tar.gz";
-    sha256 = "0wxwf02d3raglwqsxdsgf89fniakv1m19q825w76k5z004g18y42";
-  };
-
-  buildInputs = with pythonPackages; [ nose ];
-
-  # Automatic tests cannot be run because it needs to import some local modules for tests.
-  doCheck = false;
-  checkPhase = ''
-    nosetests
-  '';
-
-  propagatedBuildInputs = with pythonPackages; [
-    beautifulsoup4
-    bottle
-    chardet
-    dateutil
-    google_api_python_client
-    lxml
-    ply
-    python_magic
-  ];
-
-  meta = {
-    homepage = http://furius.ca/beancount/;
-    description = "Double-entry bookkeeping computer language";
-    longDescription = ''
-        A double-entry bookkeeping computer language that lets you define
-        financial transaction records in a text file, read them in memory,
-        generate a variety of reports from them, and provides a web interface.
-    '';
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = with stdenv.lib.maintainers; [ ];
-  };
-}
-
diff --git a/pkgs/applications/office/fava/default.nix b/pkgs/applications/office/fava/default.nix
index 9040e5cb885..9c8f39d52f1 100644
--- a/pkgs/applications/office/fava/default.nix
+++ b/pkgs/applications/office/fava/default.nix
@@ -5,12 +5,12 @@ let
 in
 buildPythonApplication rec {
   pname = "fava";
-  version = "1.6";
+  version = "1.7";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "0iif4imx76ra0lsisksrq5vf54wbivnrb3xqz6mkx9lik3pp5sbx";
+    sha256 = "c4eba4203bddaa7bc9d54971d2afeeebab0bc80ce89be1375a41a07c4e82b62f";
   };
 
   doCheck = false;
diff --git a/pkgs/applications/version-management/git-and-tools/git/default.nix b/pkgs/applications/version-management/git-and-tools/git/default.nix
index e545cb33bef..38509dddeb8 100644
--- a/pkgs/applications/version-management/git-and-tools/git/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/git/default.nix
@@ -58,8 +58,6 @@ stdenv.mkDerivation {
       + (if pythonSupport then "PYTHON_PATH=${python}/bin/python" else "NO_PYTHON=1")
       + (if stdenv.isSunOS then " INSTALL=install NO_INET_NTOP= NO_INET_PTON=" else "")
       + (if stdenv.isDarwin then " NO_APPLE_COMMON_CRYPTO=1" else " sysconfdir=/etc/ ")
-      # XXX: USE_PCRE2 might be useful in general, look into it
-      # XXX other alpine options?
       + (if stdenv.hostPlatform.isMusl then "NO_SYS_POLL_H=1 NO_GETTEXT=YesPlease" else "");
 
   # build git-credential-osxkeychain if darwin
diff --git a/pkgs/applications/version-management/gitlab/default.nix b/pkgs/applications/version-management/gitlab/default.nix
index 1c3d1928a8b..7cfaeff3382 100644
--- a/pkgs/applications/version-management/gitlab/default.nix
+++ b/pkgs/applications/version-management/gitlab/default.nix
@@ -1,5 +1,5 @@
 { pkgs, stdenv, lib, bundler, fetchurl, fetchFromGitHub, bundlerEnv, libiconv
-, ruby, tzdata, git, procps, dpkg, nettools
+, ruby, tzdata, git, ps, dpkg, nettools
 }:
 
 /* When updating the Gemfile add `gem "activerecord-nulldb-adapter"`
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [
-    rubyEnv ruby bundler tzdata git procps dpkg nettools
+    rubyEnv ruby bundler tzdata git ps dpkg nettools
   ];
 
   patches = [
@@ -56,7 +56,7 @@ stdenv.mkDerivation rec {
     rm config/initializers/gitlab_shell_secret_token.rb
 
     substituteInPlace app/controllers/admin/background_jobs_controller.rb \
-        --replace "ps -U" "${procps}/bin/ps -U"
+        --replace "ps -U" "${ps}/bin/ps -U"
 
     sed -i '/ask_to_continue/d' lib/tasks/gitlab/two_factor.rake
 
diff --git a/pkgs/applications/version-management/mercurial/default.nix b/pkgs/applications/version-management/mercurial/default.nix
index 68750bb9e6e..a00393abf27 100644
--- a/pkgs/applications/version-management/mercurial/default.nix
+++ b/pkgs/applications/version-management/mercurial/default.nix
@@ -4,7 +4,7 @@
 
 let
   # if you bump version, update pkgs.tortoisehg too or ping maintainer
-  version = "4.5";
+  version = "4.5.2";
   name = "mercurial-${version}";
   inherit (python2Packages) docutils hg-git dulwich python;
 in python2Packages.buildPythonApplication {
@@ -13,7 +13,7 @@ in python2Packages.buildPythonApplication {
 
   src = fetchurl {
     url = "https://mercurial-scm.org/release/${name}.tar.gz";
-    sha256 = "0rgjy42zdlbzgp4qq49amzplfcvycyijf4kdhc5wk3fqz7cki4sd";
+    sha256 = "14732hhw2ibvy5khqxjc8a983z3rib5vp9lqfbws80lm3kyryjm4";
   };
 
   inherit python; # pass it so that the same version can be used in hg2git
diff --git a/pkgs/applications/version-management/tortoisehg/default.nix b/pkgs/applications/version-management/tortoisehg/default.nix
index 437062f7f5e..3f33410f1b1 100644
--- a/pkgs/applications/version-management/tortoisehg/default.nix
+++ b/pkgs/applications/version-management/tortoisehg/default.nix
@@ -2,11 +2,11 @@
 
 python2Packages.buildPythonApplication rec {
     name = "tortoisehg-${version}";
-    version = "4.5";
+    version = "4.5.2";
 
     src = fetchurl {
       url = "https://bitbucket.org/tortoisehg/targz/downloads/${name}.tar.gz";
-      sha256 = "11m2hir2y1hblg9sqmansv16rcp560j2d3nhqzfhkim46a59fxvk";
+      sha256 = "0q12zjpgafdch4ns31k4afy25g837xm7v2qwj62806l2dz4rm4h9";
     };
 
     pythonPath = with python2Packages; [ pyqt4 mercurial qscintilla iniparse ];
diff --git a/pkgs/applications/video/kodi/default.nix b/pkgs/applications/video/kodi/default.nix
index 8a40912a1d6..64119d2dfc5 100644
--- a/pkgs/applications/video/kodi/default.nix
+++ b/pkgs/applications/video/kodi/default.nix
@@ -13,7 +13,7 @@
 , libmpeg2, libsamplerate, libmad
 , libogg, libvorbis, flac, libxslt
 , lzo, libcdio, libmodplug, libass, libbluray
-, sqlite, mysql, nasm, gnutls, libva, wayland
+, sqlite, mysql, nasm, gnutls, libva, libdrm, wayland
 , curl, bzip2, zip, unzip, glxinfo, xdpyinfo
 , libcec, libcec_platform, dcadec, libuuid
 , libcrossguid, libmicrohttpd
@@ -121,7 +121,7 @@ in stdenv.mkDerivation rec {
       gnutls libidn libtasn1 nasm p11-kit
       libxml2 yasm python2
       boost libmicrohttpd
-      gettext pcre-cpp yajl fribidi libva
+      gettext pcre-cpp yajl fribidi libva libdrm
       openssl gperf tinyxml2 taglib libssh swig jre
       libX11 xproto inputproto libXt libXmu libXext xextproto
       libXinerama libXrandr randrproto libXtst libXfixes fixesproto
diff --git a/pkgs/applications/virtualization/qemu/default.nix b/pkgs/applications/virtualization/qemu/default.nix
index 00303be12da..055273d0dac 100644
--- a/pkgs/applications/virtualization/qemu/default.nix
+++ b/pkgs/applications/virtualization/qemu/default.nix
@@ -7,11 +7,13 @@
 , numaSupport ? stdenv.isLinux && !stdenv.isArm, numactl
 , seccompSupport ? stdenv.isLinux, libseccomp
 , pulseSupport ? !stdenv.isDarwin, libpulseaudio
-, sdlSupport ? !stdenv.isDarwin, SDL
+, sdlSupport ? !stdenv.isDarwin, SDL2
 , vncSupport ? true, libjpeg, libpng
 , spiceSupport ? !stdenv.isDarwin, spice, spice-protocol
 , usbredirSupport ? spiceSupport, usbredir
 , xenSupport ? false, xen
+, openGLSupport ? sdlSupport, mesa_noglu, epoxy, libdrm
+, virglSupport ? openGLSupport, virglrenderer
 , hostCpuOnly ? false
 , nixosTestRunner ? false
 }:
@@ -52,18 +54,42 @@ stdenv.mkDerivation rec {
     ++ optionals seccompSupport [ libseccomp ]
     ++ optionals numaSupport [ numactl ]
     ++ optionals pulseSupport [ libpulseaudio ]
-    ++ optionals sdlSupport [ SDL ]
+    ++ optionals sdlSupport [ SDL2 ]
     ++ optionals vncSupport [ libjpeg libpng ]
     ++ optionals spiceSupport [ spice-protocol spice ]
     ++ optionals usbredirSupport [ usbredir ]
     ++ optionals stdenv.isLinux [ alsaLib libaio libcap_ng libcap attr ]
-    ++ optionals xenSupport [ xen ];
+    ++ optionals xenSupport [ xen ]
+    ++ optionals openGLSupport [ mesa_noglu epoxy libdrm ]
+    ++ optionals virglSupport [ virglrenderer ];
 
   enableParallelBuilding = true;
 
-  patches = [ ./no-etc-install.patch ./statfs-flags.patch ]
+  patches = [ ./no-etc-install.patch ./statfs-flags.patch (fetchpatch {
+    name = "glibc-2.27-memfd.patch";
+    url = "https://git.qemu.org/?p=qemu.git;a=patch;h=75e5b70e6b5dcc4f2219992d7cffa462aa406af0";
+    sha256 = "0gaz93kb33qc0jx6iphvny0yrd17i8zhcl3a9ky5ylc2idz0wiwa";
+  }) ]
     ++ optional nixosTestRunner ./force-uid0-on-9p.patch
-    ++ optional pulseSupport ./fix-hda-recording.patch;
+    ++ optional pulseSupport ./fix-hda-recording.patch
+    ++ optionals stdenv.hostPlatform.isMusl [
+    (fetchpatch {
+      url = https://raw.githubusercontent.com/alpinelinux/aports/2bb133986e8fa90e2e76d53369f03861a87a74ef/main/qemu/xattr_size_max.patch;
+      sha256 = "1xfdjs1jlvs99hpf670yianb8c3qz2ars8syzyz8f2c2cp5y4bxb";
+    })
+    (fetchpatch {
+      url = https://raw.githubusercontent.com/alpinelinux/aports/2bb133986e8fa90e2e76d53369f03861a87a74ef/main/qemu/musl-F_SHLCK-and-F_EXLCK.patch;
+      sha256 = "1gm67v41gw6apzgz7jr3zv9z80wvkv0jaxd2w4d16hmipa8bhs0k";
+    })
+    (fetchpatch {
+      url = https://raw.githubusercontent.com/alpinelinux/aports/61a7a1b77a868e3b940c0b25e6c2b2a6c32caf20/main/qemu/0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch;
+      sha256 = "1ar6r1vpmhnbs72v6mhgyahcjcf7b9b4xi7asx17sy68m171d2g6";
+    })
+    (fetchpatch {
+      url = https://raw.githubusercontent.com/alpinelinux/aports/2bb133986e8fa90e2e76d53369f03861a87a74ef/main/qemu/fix-sigevent-and-sigval_t.patch;
+      sha256 = "0wk0rrcqywhrw9hygy6ap0lfg314m9z1wr2hn8338r5gfcw75mav";
+    })
+  ];
 
   hardeningDisable = [ "stackprotector" ];
 
@@ -84,7 +110,9 @@ stdenv.mkDerivation rec {
     ++ optional hostCpuOnly "--target-list=${hostCpuTargets}"
     ++ optional stdenv.isDarwin "--enable-cocoa"
     ++ optional stdenv.isLinux "--enable-linux-aio"
-    ++ optional xenSupport "--enable-xen";
+    ++ optional xenSupport "--enable-xen"
+    ++ optional openGLSupport "--enable-opengl"
+    ++ optional virglSupport "--enable-virglrenderer";
 
   postFixup =
     ''
diff --git a/pkgs/applications/virtualization/qemu/riscv.nix b/pkgs/applications/virtualization/qemu/riscv.nix
index 29cb8f5bfbc..2159ad4b4dc 100644
--- a/pkgs/applications/virtualization/qemu/riscv.nix
+++ b/pkgs/applications/virtualization/qemu/riscv.nix
@@ -15,11 +15,16 @@
 in lib.overrideDerivation qemu (orig: {
   name = "${(builtins.parseDrvName qemu.name).name}-${version}pre${revCount}_${shortRev}";
   inherit src;
+# <<<<<<< HEAD
+#   # https://github.com/riscv/riscv-qemu/pull/109
+#   patches = [ ./no-etc-install.patch ./statfs-flags.patch ./riscv-initrd.patch ];
+# =======
   # The pulseaudio and statfs patches are in 2.12.0+, which this is based on
   patches = [
     ./force-uid0-on-9p.patch
     ./no-etc-install.patch
   ];
+
   configureFlags = orig.configureFlags ++ [ "--target-list=${lib.concatStringsSep "," targets}" ];
   postInstall = null;
 })
diff --git a/pkgs/applications/window-managers/icewm/default.nix b/pkgs/applications/window-managers/icewm/default.nix
index 3329b3b69e0..8406736541c 100644
--- a/pkgs/applications/window-managers/icewm/default.nix
+++ b/pkgs/applications/window-managers/icewm/default.nix
@@ -25,6 +25,11 @@ stdenv.mkDerivation rec {
     export cmakeFlags="-DPREFIX=$out -DCFGDIR=/etc/icewm"
   '';
 
+  patches = [ ./fix-strlcat_strlcpy.patch ] ++
+    stdenv.lib.optional stdenv.hostPlatform.isMusl ./musl.patch;
+
+  patchFlags = [ "-p0" ];
+
   meta = {
     description = "A simple, lightweight X window manager";
     longDescription = ''
diff --git a/pkgs/applications/window-managers/icewm/fix-strlcat_strlcpy.patch b/pkgs/applications/window-managers/icewm/fix-strlcat_strlcpy.patch
new file mode 100644
index 00000000000..9721e125b05
--- /dev/null
+++ b/pkgs/applications/window-managers/icewm/fix-strlcat_strlcpy.patch
@@ -0,0 +1,236 @@
+--- src/apppstatus.cc	2017-07-30 10:59:06.000000000 +0200
++++ src/apppstatus.cc	2017-08-09 09:12:54.332052762 +0200
+@@ -366,7 +366,7 @@
+             sscanf(p, "%s %s %s %s %s", val[0], val[1], val[2], val[3], val[4]);
+             for (i = 0; i < 4; i++) {
+                 if (strncmp(val[i+1], "?", 1) != 0)
+-                    strlcpy(phoneNumber, val[i+1], sizeof phoneNumber);
++                    my_strlcpy(phoneNumber, val[i+1], sizeof phoneNumber);
+             }
+         }
+ 
+--- src/base.h	2017-07-30 10:59:06.000000000 +0200
++++ src/base.h	2017-08-09 09:11:13.082025484 +0200
+@@ -44,9 +44,9 @@
+ /*** String Functions *********************************************************/
+ 
+ /* Prefer this as a safer alternative over strcpy. Return strlen(from). */
+-size_t strlcpy(char *dest, const char *from, size_t dest_size);
++size_t my_strlcpy(char *dest, const char *from, size_t dest_size);
+ /* Prefer this over strcat. Return strlen(dest) + strlen(from). */
+-size_t strlcat(char *dest, const char *from, size_t dest_size);
++size_t my_strlcat(char *dest, const char *from, size_t dest_size);
+ 
+ char *newstr(char const *str);
+ char *newstr(char const *str, int len);
+--- src/gnome2.cc	2017-07-30 10:59:06.000000000 +0200
++++ src/gnome2.cc	2017-08-09 09:11:21.819027846 +0200
+@@ -158,8 +158,8 @@
+     const int plen = strlen(fPath);
+ 
+     char tmp[256];
+-    strlcpy(tmp, fPath, sizeof tmp);
+-    strlcat(tmp, "/.directory", sizeof tmp);
++    my_strlcpy(tmp, fPath, sizeof tmp);
++    my_strlcat(tmp, "/.directory", sizeof tmp);
+ 
+     if (isDir && !stat(tmp, &sb)) { // looks like kde/gnome1 style
+ 
+@@ -279,8 +279,8 @@
+ 
+             while ((file = readdir(dir)) != NULL) {
+                 char fullpath[256];
+-                strlcpy(fullpath, dirname, sizeof fullpath);
+-                strlcat(fullpath, file->d_name, sizeof fullpath);
++                my_strlcpy(fullpath, dirname, sizeof fullpath);
++                my_strlcat(fullpath, file->d_name, sizeof fullpath);
+                 GnomeDesktopItem *ditem =
+                     gnome_desktop_item_new_from_file(fullpath,
+                                                      (GnomeDesktopItemLoadFlags)0,
+--- src/icehelp.cc	2017-07-30 10:59:06.000000000 +0200
++++ src/icehelp.cc	2017-08-09 09:11:31.490030459 +0200
+@@ -1790,8 +1790,8 @@
+     const size_t size = 9 + strlen(cfmt) + strlen(cstr) + strlen(crea);
+     char *cbuf = (char *)malloc(size);
+     snprintf(cbuf, size, cfmt, cstr);
+-    strlcat(cbuf, ":\n ", size);
+-    strlcat(cbuf, crea, size);
++    my_strlcat(cbuf, ":\n ", size);
++    my_strlcat(cbuf, crea, size);
+ 
+     node *root = new node(node::div);
+     flist<node> nodes(root);
+--- src/icesm.cc	2017-07-30 10:59:06.000000000 +0200
++++ src/icesm.cc	2017-08-09 09:13:12.946057758 +0200
+@@ -28,10 +28,10 @@
+         wordexp_t w;
+         if (wordexp(trim(buf), &w, 0) != 0 || w.we_wordc == 0)
+             return false;
+-        size_t len = strlcpy(buf, trim(w.we_wordv[0]), bufsiz);
++        size_t len = my_strlcpy(buf, trim(w.we_wordv[0]), bufsiz);
+         for (size_t k = 1; k < w.we_wordc && len < bufsiz; ++k) {
+-            strlcat(buf, " ", bufsiz);
+-            len = strlcat(buf, trim(w.we_wordv[k]), bufsiz);
++            my_strlcat(buf, " ", bufsiz);
++            len = my_strlcat(buf, trim(w.we_wordv[k]), bufsiz);
+         }
+         wordfree(&w);
+         if (len >= bufsiz)
+@@ -39,7 +39,7 @@
+ #else
+         char *str = trim(buf);
+         if (str > buf)
+-            strlcpy(buf, str, bufsiz);
++            my_strlcpy(buf, str, bufsiz);
+ #endif
+         if (buf[0] == '#' || buf[0] == '=')
+             buf[0] = 0;
+--- src/icesound.cc	2017-07-30 10:59:06.000000000 +0200
++++ src/icesound.cc	2017-08-09 09:11:26.686029161 +0200
+@@ -145,8 +145,8 @@
+     char * findSample(int sid)  {
+         char basefname[1024];
+ 
+-        strlcpy(basefname, gui_events[sid].name, sizeof basefname);
+-        strlcat(basefname, ".wav", sizeof basefname);
++        my_strlcpy(basefname, gui_events[sid].name, sizeof basefname);
++        my_strlcat(basefname, ".wav", sizeof basefname);
+ 
+         return findSample(basefname);
+     }
+--- src/misc.cc	2017-07-30 10:59:06.000000000 +0200
++++ src/misc.cc	2017-08-09 09:13:39.372064834 +0200
+@@ -448,7 +448,7 @@
+ #endif
+ 
+ /* Prefer this as a safer alternative over strcpy. Return strlen(from). */
+-size_t strlcpy(char *dest, const char *from, size_t dest_size)
++size_t my_strlcpy(char *dest, const char *from, size_t dest_size)
+ {
+     const char *in = from;
+     if (dest_size > 0) {
+@@ -463,12 +463,12 @@
+ }
+ 
+ /* Prefer this over strcat. Return strlen(dest) + strlen(from). */
+-size_t strlcat(char *dest, const char *from, size_t dest_size)
++size_t my_strlcat(char *dest, const char *from, size_t dest_size)
+ {
+     char *to = dest;
+     char *const stop = to + dest_size - 1;
+     while (to < stop && *to) ++to;
+-    return to - dest + strlcpy(to, from, dest_size - (to - dest));
++    return to - dest + my_strlcpy(to, from, dest_size - (to - dest));
+ }
+ 
+ char *newstr(char const *str) {
+--- src/strtest.cc	2017-07-30 10:59:06.000000000 +0200
++++ src/strtest.cc	2017-08-09 09:13:24.395060823 +0200
+@@ -286,63 +286,63 @@
+     strtest tester("strlc");
+     char d[10] = "@";
+     size_t n;
+-    n = strlcpy(d, "", 0);
++    n = my_strlcpy(d, "", 0);
+     sequal(d, "@");
+     assert(d, n == 0);
+ 
+-    n = strlcpy(d, "a", 0);
++    n = my_strlcpy(d, "a", 0);
+     sequal(d, "@");
+     assert(d, n == 1);
+ 
+-    n = strlcpy(d, "", 1);
++    n = my_strlcpy(d, "", 1);
+     sequal(d, "");
+     assert(d, n == 0);
+ 
+-    n = strlcpy(d, "a", 1);
++    n = my_strlcpy(d, "a", 1);
+     sequal(d, "");
+     assert(d, n == 1);
+ 
+-    n = strlcpy(d, "a", 2);
++    n = my_strlcpy(d, "a", 2);
+     sequal(d, "a");
+     assert(d, n == 1);
+ 
+-    n = strlcpy(d, "ab", 2);
++    n = my_strlcpy(d, "ab", 2);
+     sequal(d, "a");
+     assert(d, n == 2);
+ 
+-    n = strlcpy(d, "ab", 3);
++    n = my_strlcpy(d, "ab", 3);
+     sequal(d, "ab");
+     assert(d, n == 2);
+ 
+-    n = strlcpy(d, "abc", sizeof d);
++    n = my_strlcpy(d, "abc", sizeof d);
+     sequal(d, "abc");
+     assert(d, n == 3);
+ 
+-    n = strlcat(d, "def", 4);
++    n = my_strlcat(d, "def", 4);
+     sequal(d, "abc");
+     assert(d, n == 6);
+ 
+-    n = strlcat(d, "def", sizeof d);
++    n = my_strlcat(d, "def", sizeof d);
+     sequal(d, "abcdef");
+     assert(d, n == 6);
+ 
+-    n = strlcat(d, "ghijkl", sizeof d);
++    n = my_strlcat(d, "ghijkl", sizeof d);
+     sequal(d, "abcdefghi");
+     assert(d, n == 12);
+ 
+-    n = strlcpy(d, "123", sizeof d);
++    n = my_strlcpy(d, "123", sizeof d);
+     sequal(d, "123");
+     assert(d, n == 3);
+ 
+-    n = strlcpy(d, d + 1, sizeof d);
++    n = my_strlcpy(d, d + 1, sizeof d);
+     sequal(d, "23");
+     assert(d, n == 2);
+ 
+-    n = strlcpy(d, d + 1, sizeof d);
++    n = my_strlcpy(d, d + 1, sizeof d);
+     sequal(d, "3");
+     assert(d, n == 1);
+ 
+-    n = strlcpy(d, d + 1, sizeof d);
++    n = my_strlcpy(d, d + 1, sizeof d);
+     sequal(d, "");
+     assert(d, n == 0);
+ }
+@@ -418,7 +418,7 @@
+         while (a.next()) {
+             const char *e = a.entry();
+             assert(e, strcoll(buf, e) < 0);
+-            strlcpy(buf, e, sizeof buf);
++            my_strlcpy(buf, e, sizeof buf);
+         }
+         assert(buf, strcoll(buf, "~~~~~~~~~") < 0);
+     }
+@@ -437,7 +437,7 @@
+             cstring c(s.entry());
+             const char *e = c.c_str();
+             assert(e, strcoll(buf, e) < 0);
+-            strlcpy(buf, e, sizeof buf);
++            my_strlcpy(buf, e, sizeof buf);
+         }
+         assert(buf, strcoll(buf, "~~~~~~~~~") < 0);
+     }
+--- src/udir.cc	2017-07-30 10:59:06.000000000 +0200
++++ src/udir.cc	2017-08-09 09:13:28.346061883 +0200
+@@ -66,7 +66,7 @@
+     if (impl) {
+         DirPtr dirp(impl);
+         if (dirp.next()) {
+-            strlcpy(fEntry, dirp.name(), sizeof fEntry);
++            my_strlcpy(fEntry, dirp.name(), sizeof fEntry);
+             return true;
+         }
+     }
diff --git a/pkgs/applications/window-managers/icewm/musl.patch b/pkgs/applications/window-managers/icewm/musl.patch
new file mode 100644
index 00000000000..e7d18e31287
--- /dev/null
+++ b/pkgs/applications/window-managers/icewm/musl.patch
@@ -0,0 +1,23 @@
+--- src/ylocale.cc	2017-07-30 10:59:06.000000000 +0200
++++ src/ylocale.cc	2017-08-09 08:15:50.938841549 +0200
+@@ -55,6 +55,8 @@
+     int const codesetItems[] = {
+ #ifdef CONFIG_NL_CODESETS
+ 	CONFIG_NL_CODESETS
++#elif !defined(__GLIBC__)
++	CODESET, 0
+ #else
+ 	CODESET, _NL_CTYPE_CODESET_NAME, 0
+ #endif
+--- src/globit.c	2017-07-30 10:59:06.000000000 +0200
++++ src/globit.c	2017-08-09 08:17:18.691824584 +0200
+@@ -143,7 +143,9 @@
+ 	} else if (*pattern == '~') {
+ 		/* yes, tilde */
+ 		is_absolute = 2;
++#if defined(__GLIBC__)
+ 		glob_flags |= GLOB_TILDE;
++#endif
+ 		/* any slash in the pattern? */
+ 		while (*cp && *cp != '/')
+ 			++cp;
diff --git a/pkgs/applications/window-managers/weston/default.nix b/pkgs/applications/window-managers/weston/default.nix
index 2ea0480cc5e..0a5e601b012 100644
--- a/pkgs/applications/window-managers/weston/default.nix
+++ b/pkgs/applications/window-managers/weston/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, wayland, libGLU_combined, libxkbcommon, cairo, libxcb
+{ stdenv, fetchurl, pkgconfig, wayland, libGL, mesa_noglu, libxkbcommon, cairo, libxcb
 , libXcursor, xlibsWrapper, udev, libdrm, mtdev, libjpeg, pam, dbus, libinput
 , pango ? null, libunwind ? null, freerdp ? null, vaapi ? null, libva ? null
 , libwebp ? null, xwayland ? null, wayland-protocols
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [
-    wayland libGLU_combined libxkbcommon cairo libxcb libXcursor xlibsWrapper udev libdrm
+    wayland libGL mesa_noglu libxkbcommon cairo libxcb libXcursor xlibsWrapper udev libdrm
     mtdev libjpeg pam dbus libinput pango libunwind freerdp vaapi libva
     libwebp wayland-protocols
   ];