From d172d404e95d6f5e3baa5de04b9ffb5cca9cf9c1 Mon Sep 17 00:00:00 2001
From: Peter Hoeg <peter@hoeg.com>
Date: Thu, 2 Aug 2018 13:45:45 +0800
Subject: [PATCH 01/31] emacs-cmake: upstream is OK again

---
 pkgs/applications/editors/emacs-modes/melpa-packages.nix | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/pkgs/applications/editors/emacs-modes/melpa-packages.nix b/pkgs/applications/editors/emacs-modes/melpa-packages.nix
index 56b17a865df8..b4ae85943914 100644
--- a/pkgs/applications/editors/emacs-modes/melpa-packages.nix
+++ b/pkgs/applications/editors/emacs-modes/melpa-packages.nix
@@ -52,10 +52,6 @@ self:
       # part of a larger package
       caml = dontConfigure super.caml;
 
-      # part of a larger package
-      # upstream issue: missing package version
-      cmake-mode = markBroken (dontConfigure super.cmake-mode);
-
       # Expects bash to be at /bin/bash
       company-rtags = markBroken super.company-rtags;
 

From 66d16a540936c117922c96fb19ad52b803bdafc4 Mon Sep 17 00:00:00 2001
From: Peter Hoeg <peter@hoeg.com>
Date: Thu, 2 Aug 2018 13:46:07 +0800
Subject: [PATCH 02/31] emacs-evil-magit: needs git

---
 pkgs/applications/editors/emacs-modes/melpa-packages.nix | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/pkgs/applications/editors/emacs-modes/melpa-packages.nix b/pkgs/applications/editors/emacs-modes/melpa-packages.nix
index b4ae85943914..7520db00851d 100644
--- a/pkgs/applications/editors/emacs-modes/melpa-packages.nix
+++ b/pkgs/applications/editors/emacs-modes/melpa-packages.nix
@@ -75,6 +75,12 @@ self:
         inherit (self.melpaPackages) ess ctable popup;
       };
 
+      evil-magit = super.evil-magit.overrideAttrs (attrs: {
+        # searches for Git at build time
+        nativeBuildInputs =
+          (attrs.nativeBuildInputs or []) ++ [ external.git ];
+      });
+
       # missing OCaml
       flycheck-ocaml = markBroken super.flycheck-ocaml;
 

From 64c0d50fc33b2e00e1d6ee8f698bfdccf1801a51 Mon Sep 17 00:00:00 2001
From: Peter Hoeg <peter@hoeg.com>
Date: Thu, 2 Aug 2018 13:46:21 +0800
Subject: [PATCH 03/31] emacs-evil-search-highlight-persist: add dependencies

---
 pkgs/applications/editors/emacs-modes/melpa-packages.nix | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/pkgs/applications/editors/emacs-modes/melpa-packages.nix b/pkgs/applications/editors/emacs-modes/melpa-packages.nix
index 7520db00851d..d91e985da2b7 100644
--- a/pkgs/applications/editors/emacs-modes/melpa-packages.nix
+++ b/pkgs/applications/editors/emacs-modes/melpa-packages.nix
@@ -81,6 +81,11 @@ self:
           (attrs.nativeBuildInputs or []) ++ [ external.git ];
       });
 
+      # missing dependencies
+      evil-search-highlight-persist = super.evil-search-highlight-persist.overrideAttrs (attrs: {
+        packageRequires = with self; [ evil highlight ];
+      });
+
       # missing OCaml
       flycheck-ocaml = markBroken super.flycheck-ocaml;
 

From fe6313da305b47a8984336c3d7faa16b3d097589 Mon Sep 17 00:00:00 2001
From: Peter Hoeg <peter@hoeg.com>
Date: Thu, 2 Aug 2018 13:46:43 +0800
Subject: [PATCH 04/31] emacs-insert-shebang: fix compilation

---
 pkgs/applications/editors/emacs-modes/melpa-packages.nix | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/pkgs/applications/editors/emacs-modes/melpa-packages.nix b/pkgs/applications/editors/emacs-modes/melpa-packages.nix
index d91e985da2b7..0800bff12c54 100644
--- a/pkgs/applications/editors/emacs-modes/melpa-packages.nix
+++ b/pkgs/applications/editors/emacs-modes/melpa-packages.nix
@@ -115,6 +115,11 @@ self:
       # upstream issue: missing file header
       initsplit = super.initsplit;
 
+      # tries to write a log file to $HOME
+      insert-shebang = super.insert-shebang.overrideAttrs (attrs: {
+        HOME = "/tmp";
+      });
+
       # Expects bash to be at /bin/bash
       ivy-rtags = markBroken super.ivy-rtags;
 

From 667938468ba3060be6afbcc6e946c9cc89c6522e Mon Sep 17 00:00:00 2001
From: Peter Hoeg <peter@hoeg.com>
Date: Thu, 2 Aug 2018 13:47:12 +0800
Subject: [PATCH 05/31] emacs-magit-gitflow: git was missing

---
 pkgs/applications/editors/emacs-modes/melpa-packages.nix | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/pkgs/applications/editors/emacs-modes/melpa-packages.nix b/pkgs/applications/editors/emacs-modes/melpa-packages.nix
index 0800bff12c54..409b52fa0627 100644
--- a/pkgs/applications/editors/emacs-modes/melpa-packages.nix
+++ b/pkgs/applications/editors/emacs-modes/melpa-packages.nix
@@ -143,6 +143,12 @@ self:
             (attrs.nativeBuildInputs or []) ++ [ external.git ];
         });
 
+      magit-gitflow = super.magit-gitflow.overrideAttrs (attrs: {
+        # searches for Git at build time
+        nativeBuildInputs =
+          (attrs.nativeBuildInputs or []) ++ [ external.git ];
+      });
+
       # missing OCaml
       merlin = markBroken super.merlin;
 

From b1914088e1607f58a6f4983f1b1e3573c2f4a102 Mon Sep 17 00:00:00 2001
From: Peter Hoeg <peter@hoeg.com>
Date: Thu, 2 Aug 2018 13:47:33 +0800
Subject: [PATCH 06/31] emacs-powershell: upstream is OK again

---
 pkgs/applications/editors/emacs-modes/melpa-packages.nix | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/pkgs/applications/editors/emacs-modes/melpa-packages.nix b/pkgs/applications/editors/emacs-modes/melpa-packages.nix
index 409b52fa0627..1fbff18901fe 100644
--- a/pkgs/applications/editors/emacs-modes/melpa-packages.nix
+++ b/pkgs/applications/editors/emacs-modes/melpa-packages.nix
@@ -172,9 +172,6 @@ self:
             (attrs.nativeBuildInputs or []) ++ [ external.git ];
          }));
 
-      # upstream issue: truncated file
-      powershell = markBroken super.powershell;
-
       # upstream issue: mismatched filename
       processing-snippets = markBroken super.processing-snippets;
 

From bcbfed377edb82ddc2321d70110e7499dbda1ed3 Mon Sep 17 00:00:00 2001
From: Peter Hoeg <peter@hoeg.com>
Date: Thu, 2 Aug 2018 13:48:24 +0800
Subject: [PATCH 07/31] emacs-link: upstream is OK again

---
 pkgs/applications/editors/emacs-modes/melpa-packages.nix | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/pkgs/applications/editors/emacs-modes/melpa-packages.nix b/pkgs/applications/editors/emacs-modes/melpa-packages.nix
index 1fbff18901fe..023e99dacd36 100644
--- a/pkgs/applications/editors/emacs-modes/melpa-packages.nix
+++ b/pkgs/applications/editors/emacs-modes/melpa-packages.nix
@@ -126,9 +126,6 @@ self:
       # upstream issue: missing file header
       jsfmt = markBroken super.jsfmt;
 
-      # upstream issue: missing file header
-      link = markBroken super.link;
-
       # upstream issue: missing file header
       maxframe = markBroken super.maxframe;
 

From 0de9d840abfcfb114feee3a8c071f02b5a594ca8 Mon Sep 17 00:00:00 2001
From: Peter Hoeg <peter@hoeg.com>
Date: Thu, 2 Aug 2018 13:48:37 +0800
Subject: [PATCH 08/31] emacs-dictionary: upstream is OK again

---
 pkgs/applications/editors/emacs-modes/melpa-packages.nix | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/pkgs/applications/editors/emacs-modes/melpa-packages.nix b/pkgs/applications/editors/emacs-modes/melpa-packages.nix
index 023e99dacd36..c6650478fa2f 100644
--- a/pkgs/applications/editors/emacs-modes/melpa-packages.nix
+++ b/pkgs/applications/editors/emacs-modes/melpa-packages.nix
@@ -58,9 +58,6 @@ self:
       # upstream issue: missing file header
       connection = markBroken super.connection;
 
-      # upstream issue: missing file header
-      dictionary = markBroken super.dictionary;
-
       easy-kill-extras = super.easy-kill-extras.override {
         inherit (self.melpaPackages) easy-kill;
       };

From 5867097d1f7ffd24102e790d537c0e489ec3a49b Mon Sep 17 00:00:00 2001
From: Peter Hoeg <peter@hoeg.com>
Date: Thu, 2 Aug 2018 13:48:51 +0800
Subject: [PATCH 09/31] emacs-connection: upstream is OK again

---
 pkgs/applications/editors/emacs-modes/melpa-packages.nix | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/pkgs/applications/editors/emacs-modes/melpa-packages.nix b/pkgs/applications/editors/emacs-modes/melpa-packages.nix
index c6650478fa2f..96920e3baca2 100644
--- a/pkgs/applications/editors/emacs-modes/melpa-packages.nix
+++ b/pkgs/applications/editors/emacs-modes/melpa-packages.nix
@@ -55,9 +55,6 @@ self:
       # Expects bash to be at /bin/bash
       company-rtags = markBroken super.company-rtags;
 
-      # upstream issue: missing file header
-      connection = markBroken super.connection;
-
       easy-kill-extras = super.easy-kill-extras.override {
         inherit (self.melpaPackages) easy-kill;
       };

From 9ddd60138cbc8dce2aaeffdf37f0d0bf52bc22b3 Mon Sep 17 00:00:00 2001
From: Peter Hoeg <peter@hoeg.com>
Date: Thu, 2 Aug 2018 16:04:57 +0800
Subject: [PATCH 10/31] emacs-php-auto-yasnippets: fix HOME

---
 pkgs/applications/editors/emacs-modes/melpa-packages.nix | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/pkgs/applications/editors/emacs-modes/melpa-packages.nix b/pkgs/applications/editors/emacs-modes/melpa-packages.nix
index 96920e3baca2..f9022767ccd4 100644
--- a/pkgs/applications/editors/emacs-modes/melpa-packages.nix
+++ b/pkgs/applications/editors/emacs-modes/melpa-packages.nix
@@ -163,6 +163,11 @@ self:
             (attrs.nativeBuildInputs or []) ++ [ external.git ];
          }));
 
+      # tries to write to $HOME
+      php-auto-yasnippets = super.php-auto-yasnippets.overrideAttrs (attrs: {
+        HOME = "/tmp";
+      });
+
       # upstream issue: mismatched filename
       processing-snippets = markBroken super.processing-snippets;
 

From 74732ec29895236e587386f690d2ebb1722e0f96 Mon Sep 17 00:00:00 2001
From: Kirill Elagin <kirelagin@gmail.com>
Date: Sat, 4 Aug 2018 17:35:19 +0300
Subject: [PATCH 11/31] b2sum: init at 20160619

---
 pkgs/tools/security/b2sum/default.nix | 25 +++++++++++++++++++++++++
 pkgs/top-level/all-packages.nix       |  4 ++++
 2 files changed, 29 insertions(+)
 create mode 100644 pkgs/tools/security/b2sum/default.nix

diff --git a/pkgs/tools/security/b2sum/default.nix b/pkgs/tools/security/b2sum/default.nix
new file mode 100644
index 000000000000..9c14ad974b69
--- /dev/null
+++ b/pkgs/tools/security/b2sum/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, openmp }:
+
+stdenv.mkDerivation rec {
+  version = "20160619";
+  name = "b2sum-${version}";
+
+  src = fetchurl {
+    url = "https://github.com/BLAKE2/BLAKE2/archive/${version}.tar.gz";
+    sha256 = "0csnlp6kwlyla5s4r6bsrx2jgcwrm9qzisnvfdhmqsz5r8y87b6b";
+  };
+  postUnpack = "sourceRoot=$sourceRoot/b2sum";
+
+  buildInputs = [ openmp ];
+
+  makeFlags = stdenv.lib.optional (isNull openmp) "NO_OPENMP=1";
+  installFlags = [ "PREFIX=$(out)" ];
+
+  meta = with stdenv.lib; {
+    description = "The b2sum utility is similar to the md5sum or shasum utilities but for BLAKE2";
+    homepage = "https://blake2.net";
+    license = with licenses; [ asl20 cc0 openssl ];
+    maintainers = with maintainers; [ kirelagin ];
+    platforms = platforms.all;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 90576e34da08..35542e052e07 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -1579,6 +1579,10 @@ with pkgs;
 
   asynk = callPackage ../tools/networking/asynk { };
 
+  b2sum = callPackage ../tools/security/b2sum {
+    inherit (llvmPackages) openmp;
+  };
+
   bacula = callPackage ../tools/backup/bacula { };
 
   bareos = callPackage ../tools/backup/bareos { };

From 121c264c7b14b954c0c53bb04e946e8046f83bcf Mon Sep 17 00:00:00 2001
From: Kirill Elagin <kirelagin@gmail.com>
Date: Sat, 4 Aug 2018 18:54:22 +0300
Subject: [PATCH 12/31] b2sum: Update to master

---
 pkgs/tools/security/b2sum/default.nix | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/pkgs/tools/security/b2sum/default.nix b/pkgs/tools/security/b2sum/default.nix
index 9c14ad974b69..97495b8cde5f 100644
--- a/pkgs/tools/security/b2sum/default.nix
+++ b/pkgs/tools/security/b2sum/default.nix
@@ -1,12 +1,13 @@
-{ stdenv, fetchurl, openmp }:
+{ stdenv, fetchurl, openmp ? null }:
 
 stdenv.mkDerivation rec {
-  version = "20160619";
+  version = "unstable-2018-06-11";
+  rev = "320c325437539ae91091ce62efec1913cd8093c2";
   name = "b2sum-${version}";
 
   src = fetchurl {
-    url = "https://github.com/BLAKE2/BLAKE2/archive/${version}.tar.gz";
-    sha256 = "0csnlp6kwlyla5s4r6bsrx2jgcwrm9qzisnvfdhmqsz5r8y87b6b";
+    url = "https://github.com/BLAKE2/BLAKE2/archive/${rev}.tar.gz";
+    sha256 = "19f07dwli9ymlc87ikn84j4h5fv57afwj9ni7s0jkaym5l0q6nqw";
   };
   postUnpack = "sourceRoot=$sourceRoot/b2sum";
 

From 1e3c993286d50deed719467aab0f8af3b29c8c4e Mon Sep 17 00:00:00 2001
From: Jan Malakhovski <oxij@oxij.org>
Date: Sun, 5 Aug 2018 19:49:52 +0000
Subject: [PATCH 13/31] appimagekit: init at 20180727

---
 .../appimagekit/default.nix                   | 112 +++++++++++
 .../package-management/appimagekit/nix.patch  | 174 ++++++++++++++++++
 pkgs/top-level/all-packages.nix               |   2 +
 3 files changed, 288 insertions(+)
 create mode 100644 pkgs/tools/package-management/appimagekit/default.nix
 create mode 100644 pkgs/tools/package-management/appimagekit/nix.patch

diff --git a/pkgs/tools/package-management/appimagekit/default.nix b/pkgs/tools/package-management/appimagekit/default.nix
new file mode 100644
index 000000000000..2c389c144b1e
--- /dev/null
+++ b/pkgs/tools/package-management/appimagekit/default.nix
@@ -0,0 +1,112 @@
+{ stdenv, fetchFromGitHub
+, pkgconfig, cmake, autoconf, automake, libtool
+, wget, xxd, desktop-file-utils
+, glib, zlib, cairo, openssl, fuse, xz, squashfuse, inotify-tools, libarchive
+, squashfsTools
+, gtest
+}:
+
+let
+
+  appimagekit_src = fetchFromGitHub {
+    owner = "AppImage";
+    repo = "AppImageKit";
+    rev = "b0859501df61cde198b54a317c03b41dbafc98b1";
+    sha256 = "0qqg79jw9w9rs8c2w3lla4kz62ihafrf7jm370pp1dl8y2i81jzg";
+  };
+
+  # squashfuse adapted to nix from cmake experession in "${appimagekit_src}/cmake/dependencies.cmake"
+  appimagekit_squashfuse = squashfuse.overrideAttrs (attrs: rec {
+    name = "squashfuse-${version}";
+    version = "20161009";
+
+    src = fetchFromGitHub {
+      owner = "vasi";
+      repo  = "squashfuse";
+      rev   = "1f980303b89c779eabfd0a0fdd36d6a7a311bf92";
+      sha256 = "0lrw9ff8k15l34wjwyllw3i35hl0cms97jj2hpnr2q8ipgxpb5q5";
+    };
+
+    patches = [
+      "${appimagekit_src}/squashfuse.patch"
+      "${appimagekit_src}/squashfuse_dlopen.patch"
+    ];
+
+    postPatch = ''
+      cp -v ${appimagekit_src}/squashfuse_dlopen.[hc] .
+    '';
+
+    preConfigure = ''
+      sed -i "/PKG_CHECK_MODULES.*/,/,:./d" configure
+      sed -i "s/typedef off_t sqfs_off_t/typedef int64_t sqfs_off_t/g" common.h
+    '';
+
+    configureFlags = [
+      "--disable-demo" "--disable-high-level" "--without-lzo" "--without-lz4"
+    ];
+
+    postConfigure = ''
+      sed -i "s|XZ_LIBS = -llzma |XZ_LIBS = -Bstatic -llzma/|g" Makefile
+    '';
+
+    # only static libs and header files
+    installPhase = ''
+      mkdir -p $out/lib $out/include
+      cp -v ./.libs/*.a $out/lib
+      cp -v ./*.h $out/include
+    '';
+  });
+
+in stdenv.mkDerivation rec {
+  name = "appimagekit-20180727";
+
+  src = appimagekit_src;
+
+  patches = [ ./nix.patch ];
+
+  nativeBuildInputs = [
+    pkgconfig cmake autoconf automake libtool wget xxd
+    desktop-file-utils
+  ];
+
+  buildInputs = [
+    glib zlib cairo openssl fuse
+    xz inotify-tools libarchive
+    squashfsTools
+  ];
+
+  preConfigure = ''
+    export HOME=$(pwd)
+  '';
+
+  cmakeFlags = [
+    "-DUSE_SYSTEM_XZ=ON"
+    "-DUSE_SYSTEM_SQUASHFUSE=ON"
+    "-DSQUASHFUSE=${appimagekit_squashfuse}"
+    "-DUSE_SYSTEM_INOTIFY_TOOLS=ON"
+    "-DUSE_SYSTEM_LIBARCHIVE=ON"
+    "-DUSE_SYSTEM_GTEST=ON"
+    "-DUSE_SYSTEM_MKSQUASHFS=ON"
+    "-DBUILD_TESTING=${if doCheck then "ON" else "OFF"}"
+  ];
+
+  checkInputs = [ gtest ];
+  doCheck = false; # fails 1 out of 4 tests, I'm too lazy to debug why
+
+  # for debugging
+  passthru = {
+    squashfuse = appimagekit_squashfuse;
+  };
+
+  meta = with stdenv.lib; {
+    description = "A tool to package desktop applications as AppImages";
+    longDescription = ''
+      AppImageKit is an implementation of the AppImage format that
+      provides tools such as appimagetool and appimaged for handling
+      AppImages.
+    '';
+    license = licenses.mit;
+    homepage = src.meta.homepage;
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/tools/package-management/appimagekit/nix.patch b/pkgs/tools/package-management/appimagekit/nix.patch
new file mode 100644
index 000000000000..9725cef5ba7d
--- /dev/null
+++ b/pkgs/tools/package-management/appimagekit/nix.patch
@@ -0,0 +1,174 @@
+diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake
+index ea133a3..916606c 100644
+--- a/cmake/dependencies.cmake
++++ b/cmake/dependencies.cmake
+@@ -224,21 +224,23 @@ if(NOT USE_SYSTEM_XZ)
+         LIBRARY_DIRS <INSTALL_DIR>/lib/
+         LIBRARIES "<INSTALL_DIR>/lib/liblzma.a"
+         INCLUDE_DIRS "<SOURCE_DIR>/src/liblzma/api/"
+     )
+ else()
+     message(STATUS "Using system xz")
+ 
+     import_pkgconfig_target(TARGET_NAME xz PKGCONFIG_TARGET liblzma STATIC)
+ endif()
+ 
++set(USE_SYSTEM_SQUASHFUSE OFF CACHE BOOL "Use system squashfuse instead of building our own")
+ 
++if(NOT USE_SYSTEM_SQUASHFUSE)
+ # as distros don't provide suitable squashfuse and squashfs-tools, those dependencies are bundled in, can, and should
+ # be used from this repository
+ # TODO: implement out-of-source builds for squashfuse, as for the other dependencies
+ configure_file(
+     ${CMAKE_CURRENT_SOURCE_DIR}/src/patch-squashfuse.sh.in
+     ${CMAKE_CURRENT_BINARY_DIR}/patch-squashfuse.sh
+     @ONLY
+ )
+ 
+ ExternalProject_Add(squashfuse-EXTERNAL
+@@ -259,20 +261,34 @@ ExternalProject_Add(squashfuse-EXTERNAL
+     BUILD_IN_SOURCE ON
+     INSTALL_COMMAND ${MAKE} install
+ )
+ 
+ import_external_project(
+     TARGET_NAME squashfuse
+     EXT_PROJECT_NAME squashfuse-EXTERNAL
+     LIBRARIES "<SOURCE_DIR>/.libs/libsquashfuse.a;<SOURCE_DIR>/.libs/libsquashfuse_ll.a;<SOURCE_DIR>/.libs/libfuseprivate.a"
+     INCLUDE_DIRS "<SOURCE_DIR>"
+ )
++else()
++    message(STATUS "Using system squashfsfuse from ${SQUASHFUSE}")
++
++    add_library(squashfuse INTERFACE IMPORTED GLOBAL)
++
++    set(squashfuse_INCLUDE_DIRS "${SQUASHFUSE}/include")
++    set(squashfuse_LIBRARIES "${SQUASHFUSE}/lib/libsquashfuse.a;${SQUASHFUSE}/lib/libsquashfuse_ll.a;${SQUASHFUSE}/lib/libfuseprivate.a")
++
++    set_property(
++      TARGET squashfuse
++      PROPERTY INTERFACE_LINK_LIBRARIES ${squashfuse_LIBRARIES}
++    )
++    include_directories(${squashfuse_INCLUDE_DIRS})
++endif()
+ 
+ 
+ set(USE_SYSTEM_INOTIFY_TOOLS OFF CACHE BOOL "Use system libinotifytools instead of building our own")
+ 
+ if(NOT USE_SYSTEM_INOTIFY_TOOLS)
+     message(STATUS "Downloading and building inotify-tools")
+ 
+     # TODO: build out of source
+     ExternalProject_Add(inotify-tools-EXTERNAL
+         URL https://github.com/downloads/rvoicilas/inotify-tools/inotify-tools-3.14.tar.gz
+@@ -345,20 +361,23 @@ if(NOT USE_SYSTEM_GTEST)
+             INCLUDE_DIRS "<INSTALL_DIR>/include/"
+         )
+     else()
+         message(STATUS "Using system GTest")
+ 
+         import_find_pkg_target(gtest GTest GTEST)
+     endif()
+ endif()
+ 
+ 
++set(USE_SYSTEM_MKSQUASHFS OFF CACHE BOOL "Use system mksquashfs instead of downloading and building our own")
++
++if(NOT USE_SYSTEM_MKSQUASHFS)
+ # TODO: allow using system wide mksquashfs
+ set(mksquashfs_cflags "-DXZ_SUPPORT ${CFLAGS}")
+ 
+ if(xz_LIBRARIES MATCHES "\\.a$")
+     set(mksquashfs_ldflags "${xz_LIBRARIES}")
+ else()
+     set(mksquashfs_ldflags "-l${xz_LIBRARIES}")
+ endif()
+ 
+ if(xz_INCLUDE_DIRS)
+@@ -385,20 +404,25 @@ ExternalProject_Add(mksquashfs
+     INSTALL_COMMAND ${MAKE} -C squashfs-tools/ install INSTALL_DIR=<INSTALL_DIR>
+ )
+ 
+ ExternalProject_Get_Property(mksquashfs INSTALL_DIR)
+ set(mksquashfs_INSTALL_DIR "${INSTALL_DIR}")
+ mark_as_advanced(mksquashfs_INSTALL_DIR)
+ 
+ # for later use when packaging as an AppImage
+ set(mksquashfs_BINARY "${mksquashfs_INSTALL_DIR}/mksquashfs")
+ mark_as_advanced(mksquashfs_BINARY)
++else()
++    message(STATUS "Using system mksquashfs")
++
++    set(mksquashfs_BINARY "mksquashfs")
++endif()
+ 
+ 
+ #### build dependency configuration ####
+ 
+ # only have to build custom xz when not using system libxz
+ if(TARGET xz-EXTERNAL)
+     if(TARGET squashfuse-EXTERNAL)
+         ExternalProject_Add_StepDependencies(squashfuse-EXTERNAL configure xz-EXTERNAL)
+     endif()
+     if(TARGET mksquashfs)
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 3f25442..974ed0e 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -197,27 +197,27 @@ target_include_directories(digest_md5
+ 
+ target_link_libraries(digest_md5
+     PRIVATE
+     libglib
+ )
+ 
+ 
+ # install binaries
+ if(AUXILIARY_FILES_DESTINATION)
+     install(
+-        PROGRAMS ${mksquashfs_INSTALL_DIR}/mksquashfs ${CMAKE_CURRENT_BINARY_DIR}/runtime
++        PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/runtime
+         DESTINATION ${AUXILIARY_FILES_DESTINATION}
+         COMPONENT applications
+     )
+ else()
+     install(
+-        PROGRAMS ${mksquashfs_INSTALL_DIR}/mksquashfs ${CMAKE_CURRENT_BINARY_DIR}/runtime
++        PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/runtime
+         DESTINATION bin
+         COMPONENT applications
+     )
+ endif()
+ 
+ install(
+     TARGETS AppRun appimagetool digest validate
+     RUNTIME DESTINATION bin COMPONENT applications
+     LIBRARY DESTINATION lib COMPONENT applications
+     ARCHIVE DESTINATION lib/static COMPONENT applications
+diff --git a/src/shared.c b/src/shared.c
+index cf5fd5c..4f48dbc 100644
+--- a/src/shared.c
++++ b/src/shared.c
+@@ -34,21 +34,21 @@
+ #include <sys/stat.h>
+ #include <sys/types.h>
+ #include <dirent.h>
+ #include <errno.h>
+ 
+ #include <glib.h>
+ #include <glib/gprintf.h>
+ #include <glib/gstdio.h>
+ #include <gio/gio.h>
+ 
+-#include "squashfuse.h"
++#include <squashfuse.h>
+ #include <squashfs_fs.h>
+ #include "getsection.h"
+ #include "elf.h"
+ 
+ #include "xdg-basedir.h"
+ 
+ // own header
+ #include "shared.h"
+ 
+ #if HAVE_LIBARCHIVE3 == 1 // CentOS
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 09ee4454fe2f..40be1beeda0f 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -508,6 +508,8 @@ with pkgs;
 
   appimage-run = callPackage ../tools/package-management/appimage-run {};
 
+  appimagekit = callPackage ../tools/package-management/appimagekit {};
+
   apt-cacher-ng = callPackage ../servers/http/apt-cacher-ng { };
 
   apt-offline = callPackage ../tools/misc/apt-offline { };

From 9823e4caa7a4f40d2dd00351e815fffda9ffcccc Mon Sep 17 00:00:00 2001
From: Peter Hoeg <peter@hoeg.com>
Date: Mon, 6 Aug 2018 17:09:26 +0800
Subject: [PATCH 14/31] emacs-magit-annex: git was missing

---
 pkgs/applications/editors/emacs-modes/melpa-packages.nix | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/pkgs/applications/editors/emacs-modes/melpa-packages.nix b/pkgs/applications/editors/emacs-modes/melpa-packages.nix
index f9022767ccd4..a420c5425565 100644
--- a/pkgs/applications/editors/emacs-modes/melpa-packages.nix
+++ b/pkgs/applications/editors/emacs-modes/melpa-packages.nix
@@ -134,6 +134,12 @@ self:
             (attrs.nativeBuildInputs or []) ++ [ external.git ];
         });
 
+      magit-annex = super.magit-annex.overrideAttrs (attrs: {
+        # searches for Git at build time
+        nativeBuildInputs =
+          (attrs.nativeBuildInputs or []) ++ [ external.git ];
+      });
+
       magit-gitflow = super.magit-gitflow.overrideAttrs (attrs: {
         # searches for Git at build time
         nativeBuildInputs =

From 10dd73b5e2415909d79503fd45144fddd417dcc8 Mon Sep 17 00:00:00 2001
From: Jan Tojnar <jtojnar@gmail.com>
Date: Mon, 6 Aug 2018 12:21:05 +0200
Subject: [PATCH 15/31] keybinder: remove GTK3 dependency

kyebinder never supported GTK 3, only keybinder-3.0 (keybinder3 package) does.

This effectively reverts c0c835dccee7d05df14d424eb7a4fbb9bd3684da
---
 pkgs/development/libraries/keybinder/default.nix | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pkgs/development/libraries/keybinder/default.nix b/pkgs/development/libraries/keybinder/default.nix
index 5110908e0f27..20ab104874dc 100644
--- a/pkgs/development/libraries/keybinder/default.nix
+++ b/pkgs/development/libraries/keybinder/default.nix
@@ -1,9 +1,9 @@
 { stdenv, fetchurl, autoconf, automake, libtool, pkgconfig, gnome3
-, gtk-doc, gtk2, python2Packages, lua, libX11, libXext, libXrender, gobjectIntrospection
+, gtk-doc, gtk2, python2Packages, lua, gobjectIntrospection
 }:
 
 let
-  inherit (python2Packages) python pygobject3 pygtk;
+  inherit (python2Packages) python pygtk;
 in stdenv.mkDerivation rec {
   name = "keybinder-${version}";
   version = "0.3.0";
@@ -16,8 +16,8 @@ in stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [
-    autoconf automake libtool gnome3.gnome-common gtk-doc gnome3.gtk3
-    python pygobject3 pygtk lua libX11 libXext libXrender gobjectIntrospection gtk2
+    autoconf automake libtool gnome3.gnome-common gtk-doc gtk2
+    python pygtk lua gobjectIntrospection
   ];
 
   preConfigure = ''

From e61dae0f0fe37c479c2f2e083d9face4c53bbb25 Mon Sep 17 00:00:00 2001
From: Michiel Leenaars <ml.software@leenaa.rs>
Date: Mon, 6 Aug 2018 12:25:25 +0200
Subject: [PATCH 16/31] matterbridge: 1.7.1 -> 1.11.0

---
 pkgs/servers/matterbridge/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/servers/matterbridge/default.nix b/pkgs/servers/matterbridge/default.nix
index 14662ff6cc25..9e5a9ffe780d 100644
--- a/pkgs/servers/matterbridge/default.nix
+++ b/pkgs/servers/matterbridge/default.nix
@@ -2,13 +2,13 @@
 
 buildGoPackage rec {
   name = "matterbridge-${version}";
-  version = "1.7.1";
+  version = "1.11.0";
 
   goPackagePath = "github.com/42wim/matterbridge";
 
   src = fetchurl {
     url = "https://github.com/42wim/matterbridge/archive/v${version}.tar.gz";
-    sha256 = "0ajc7xswmwhc2xn937sv3b76s8hblfn9x9rj5825hi3d3s8zqq88";
+    sha256 = "1fjpgdaq4mfgf36gzk3hhmlbpfn44b7xll2rdpy69y460jrjfg6k";
   };
 
   meta = with stdenv.lib; {

From 0efd8a8f709c7b20a113855788c703c382be5260 Mon Sep 17 00:00:00 2001
From: Pascal Wittmann <mail@pascal-wittmann.de>
Date: Mon, 6 Aug 2018 12:52:40 +0200
Subject: [PATCH 17/31] remove jumanji

jumanji isn't activly developed since the end of 2015
and uses an insecure and old version of webkit.
---
 .../networking/browsers/jumanji/default.nix   | 31 -------------------
 pkgs/top-level/all-packages.nix               |  5 ---
 2 files changed, 36 deletions(-)
 delete mode 100644 pkgs/applications/networking/browsers/jumanji/default.nix

diff --git a/pkgs/applications/networking/browsers/jumanji/default.nix b/pkgs/applications/networking/browsers/jumanji/default.nix
deleted file mode 100644
index 26a7e883c60c..000000000000
--- a/pkgs/applications/networking/browsers/jumanji/default.nix
+++ /dev/null
@@ -1,31 +0,0 @@
-{ stdenv, fetchgit, pkgconfig, girara, gtk, webkitgtk, glib-networking, makeWrapper
-, gsettings-desktop-schemas }:
-
-stdenv.mkDerivation rec {
-  name = "jumanji-${version}";
-  version = "20150107";
-
-  src = fetchgit {
-    url = https://git.pwmt.org/pwmt/jumanji.git;
-    rev = "f8e04e5b5a9fec47d49ca63a096e5d35be281151";
-    sha256 = "1dsbyz489fx7dp07i29q1rjkl7nhrfscc8ks8an2rdyhx3457asg";
-  };
-
-  nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ girara gtk webkitgtk makeWrapper gsettings-desktop-schemas ];
-
-  makeFlags = [ "PREFIX=$(out)" ];
-
-  preFixup=''
-    wrapProgram "$out/bin/jumanji" \
-     --prefix GIO_EXTRA_MODULES : "${glib-networking.out}/lib/gio/modules" \
-     --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
-  '';
-
-  meta = with stdenv.lib; {
-    description = "Minimal web browser";
-    homepage = https://pwmt.org/projects/jumanji/;
-    platforms = platforms.all;
-    maintainers = [ maintainers.koral ];
-  };
-}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index fd084801c6ea..20f0e0576784 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -16909,11 +16909,6 @@ with pkgs;
 
   jbrout = callPackage ../applications/graphics/jbrout { };
 
-  jumanji = callPackage ../applications/networking/browsers/jumanji {
-    webkitgtk = webkitgtk24x-gtk3;
-    gtk = gtk3;
-  };
-
   jwm = callPackage ../applications/window-managers/jwm { };
 
   k3d = callPackage ../applications/graphics/k3d {

From 77c0760ee695f72f1cecf319734f60542c1f74f1 Mon Sep 17 00:00:00 2001
From: Francesco Gazzetta <francygazz@gmail.com>
Date: Mon, 6 Aug 2018 13:15:50 +0200
Subject: [PATCH 18/31] duktape: 2.2.1 -> 2.3.0

---
 pkgs/development/interpreters/duktape/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/interpreters/duktape/default.nix b/pkgs/development/interpreters/duktape/default.nix
index 46550c835108..2178f859007f 100644
--- a/pkgs/development/interpreters/duktape/default.nix
+++ b/pkgs/development/interpreters/duktape/default.nix
@@ -2,10 +2,10 @@
 
 stdenv.mkDerivation rec {
   name = "duktape-${version}";
-  version = "2.2.1";
+  version = "2.3.0";
   src = fetchurl {
     url = "http://duktape.org/duktape-${version}.tar.xz";
-    sha256 = "1wp7mpkhizknq72ivdbkzps4radi1daqzjcjp1i54c2k4pnjxgis";
+    sha256 = "1s5g8lg0dga6x3rcq328a6hsd2sk2vzwq9zfmskjh5h6n8x2yvpd";
   };
 
   buildPhase = ''

From dbdbdaf1c68a0595c16f63a5baa048bfd87d90e7 Mon Sep 17 00:00:00 2001
From: Yegor Timoshenko <yegortimoshenko@riseup.net>
Date: Mon, 6 Aug 2018 14:47:29 +0300
Subject: [PATCH 19/31] b2sum: use fetchzip, clean up

---
 pkgs/tools/security/b2sum/default.nix | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/pkgs/tools/security/b2sum/default.nix b/pkgs/tools/security/b2sum/default.nix
index 97495b8cde5f..1679b7fddd07 100644
--- a/pkgs/tools/security/b2sum/default.nix
+++ b/pkgs/tools/security/b2sum/default.nix
@@ -1,22 +1,24 @@
-{ stdenv, fetchurl, openmp ? null }:
+{ stdenv, fetchzip, openmp ? null }:
+
+with stdenv.lib;
 
 stdenv.mkDerivation rec {
-  version = "unstable-2018-06-11";
-  rev = "320c325437539ae91091ce62efec1913cd8093c2";
   name = "b2sum-${version}";
+  version = "unstable-2018-06-11";
 
-  src = fetchurl {
-    url = "https://github.com/BLAKE2/BLAKE2/archive/${rev}.tar.gz";
-    sha256 = "19f07dwli9ymlc87ikn84j4h5fv57afwj9ni7s0jkaym5l0q6nqw";
+  src = fetchzip {
+    url = "https://github.com/BLAKE2/BLAKE2/archive/320c325437539ae91091ce62efec1913cd8093c2.tar.gz";
+    sha256 = "0agmc515avdpr64bsgv87wby2idm0d3wbndxzkhdfjgzhgv0rb8k";
   };
-  postUnpack = "sourceRoot=$sourceRoot/b2sum";
+
+  sourceRoot = "source/b2sum";
 
   buildInputs = [ openmp ];
 
-  makeFlags = stdenv.lib.optional (isNull openmp) "NO_OPENMP=1";
+  buildFlags = [ (optional (isNull openmp) "NO_OPENMP=1") ];
   installFlags = [ "PREFIX=$(out)" ];
 
-  meta = with stdenv.lib; {
+  meta = {
     description = "The b2sum utility is similar to the md5sum or shasum utilities but for BLAKE2";
     homepage = "https://blake2.net";
     license = with licenses; [ asl20 cc0 openssl ];

From a052e52a2714a4d6e38713264231bc2271e6f548 Mon Sep 17 00:00:00 2001
From: georgewhewell <georgerw@gmail.com>
Date: Sat, 14 Jul 2018 19:49:01 +0100
Subject: [PATCH 20/31] fix rasperrypifw cross build

---
 .../linux/firmware/raspberrypi-wireless/default.nix   | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/pkgs/os-specific/linux/firmware/raspberrypi-wireless/default.nix b/pkgs/os-specific/linux/firmware/raspberrypi-wireless/default.nix
index 0918279cc9a9..eb5b0bd294c8 100644
--- a/pkgs/os-specific/linux/firmware/raspberrypi-wireless/default.nix
+++ b/pkgs/os-specific/linux/firmware/raspberrypi-wireless/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ stdenv, fetchurl, dpkg }:
 
 stdenv.mkDerivation rec {
   name = "raspberrypi-wireless-firmware-${version}";
@@ -20,11 +20,12 @@ stdenv.mkDerivation rec {
   # Firmware blobs do not need fixing and should not be modified
   dontFixup = true;
 
+
   # Unpack the debian package
+  nativeBuildInputs = [ dpkg ];
   unpackCmd = ''
     if ! [[ "$curSrc" =~ \.deb$ ]]; then return 1; fi
-    ar -xf "$curSrc"
-    tar -xf data.tar.xz
+    dpkg -x "$curSrc" .
   '';
 
   installPhase = ''
@@ -39,6 +40,10 @@ stdenv.mkDerivation rec {
     cp broadcom/*.hcd "$out/lib/firmware/brcm"
   '';
 
+  outputHashMode = "recursive";
+  outputHashAlgo = "sha256";
+  outputHash = "1gwzasl5w5nc0awqv3w2081ns63wd1yds0xh0dg95dc6brnqhhf8";
+
   meta = with stdenv.lib; {
     description = "Firmware for builtin Wifi/Bluetooth devices in the Raspberry Pi 3 and Zero W";
     homepage = https://archive.raspberrypi.org/debian/pool/main/f/firmware-nonfree/;

From ce52e62a9d55d634d998d77a129c3536ecf87b1b Mon Sep 17 00:00:00 2001
From: Arnaud <root@arnaud.sh>
Date: Mon, 6 Aug 2018 15:26:41 +0200
Subject: [PATCH 21/31] maintainers: update lightdiscord's email (#44554)

---
 maintainers/maintainer-list.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix
index 0abe185ebac5..8a5b2cede46f 100644
--- a/maintainers/maintainer-list.nix
+++ b/maintainers/maintainer-list.nix
@@ -2190,7 +2190,7 @@
     name = "Nathaniel Baxter";
   };
   lightdiscord = {
-    email = "arnaud@lightdiscord.me";
+    email = "root@arnaud.sh";
     github = "lightdiscord";
     name = "Arnaud Pascal";
   };

From cb9d784e49a85972df261a273d615096b106908e Mon Sep 17 00:00:00 2001
From: Robin Gloster <mail@glob.in>
Date: Mon, 6 Aug 2018 12:06:46 +0200
Subject: [PATCH 22/31] docker-registry: Revert "[bot]: remove unreferenced
 code"

This code was referenced.

This reverts commit 87f5930c3fb2c852f5243278b7a9da8e117d95e4.

cc @volth
---
 .../modules/services/misc/docker-registry.nix | 37 +++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/nixos/modules/services/misc/docker-registry.nix b/nixos/modules/services/misc/docker-registry.nix
index 08031d33c131..9a3966ab30aa 100644
--- a/nixos/modules/services/misc/docker-registry.nix
+++ b/nixos/modules/services/misc/docker-registry.nix
@@ -5,6 +5,43 @@ with lib;
 let
   cfg = config.services.dockerRegistry;
 
+  blobCache = if cfg.enableRedisCache
+    then "redis"
+    else "inmemory";
+
+  registryConfig = {
+    version =  "0.1";
+    log.fields.service = "registry";
+    storage = {
+      cache.blobdescriptor = blobCache;
+      filesystem.rootdirectory = cfg.storagePath;
+      delete.enabled = cfg.enableDelete;
+    };
+    http = {
+      addr = ":${builtins.toString cfg.port}";
+      headers.X-Content-Type-Options = ["nosniff"];
+    };
+    health.storagedriver = {
+      enabled = true;
+      interval = "10s";
+      threshold = 3;
+    };
+  };
+
+  registryConfig.redis = mkIf cfg.enableRedisCache {
+    addr = "${cfg.redisUrl}";
+    password = "${cfg.redisPassword}";
+    db = 0;
+    dialtimeout = "10ms";
+    readtimeout = "10ms";
+    writetimeout = "10ms";
+    pool = {
+      maxidle = 16;
+      maxactive = 64;
+      idletimeout = "300s";
+    };
+  };
+
   configFile = pkgs.writeText "docker-registry-config.yml" (builtins.toJSON (recursiveUpdate registryConfig cfg.extraConfig));
 
 in {

From fcf067a1aaa8f2d3fe50681ac6e07c764c8a630a Mon Sep 17 00:00:00 2001
From: Robin Gloster <mail@glob.in>
Date: Mon, 6 Aug 2018 12:16:56 +0200
Subject: [PATCH 23/31] nixos/release.nix: add docker-registry test

---
 nixos/release.nix | 1 +
 1 file changed, 1 insertion(+)

diff --git a/nixos/release.nix b/nixos/release.nix
index 007859259b17..649517130e0e 100644
--- a/nixos/release.nix
+++ b/nixos/release.nix
@@ -277,6 +277,7 @@ in rec {
   tests.docker-tools = callTestOnMatchingSystems ["x86_64-linux"] tests/docker-tools.nix {};
   tests.docker-tools-overlay = callTestOnMatchingSystems ["x86_64-linux"] tests/docker-tools-overlay.nix {};
   tests.docker-edge = callTestOnMatchingSystems ["x86_64-linux"] tests/docker-edge.nix {};
+  tests.docker-registry = callTest tests/docker-registry.nix {};
   tests.dovecot = callTest tests/dovecot.nix {};
   tests.dnscrypt-proxy = callTestOnMatchingSystems ["x86_64-linux"] tests/dnscrypt-proxy.nix {};
   tests.ecryptfs = callTest tests/ecryptfs.nix {};

From fb333054231ad8c35785394eb4c988f2019468ea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bastian=20K=C3=B6cher?= <git@kchr.de>
Date: Mon, 6 Aug 2018 10:12:57 +0200
Subject: [PATCH 24/31] linux-kernel: Removes bcm2835_mmal_v4l2_camera_driver
 patch

The patch was only required for kernel 4.16.
---
 pkgs/os-specific/linux/kernel/patches.nix | 11 -----------
 pkgs/top-level/all-packages.nix           |  1 -
 2 files changed, 12 deletions(-)

diff --git a/pkgs/os-specific/linux/kernel/patches.nix b/pkgs/os-specific/linux/kernel/patches.nix
index 1a365046f5f3..143671428c41 100644
--- a/pkgs/os-specific/linux/kernel/patches.nix
+++ b/pkgs/os-specific/linux/kernel/patches.nix
@@ -48,17 +48,6 @@ rec {
     };
   };
 
-  # https://patchwork.kernel.org/patch/9626797/
-  # Should be included in 4.17, so this patch can be dropped when 4.16 becomes obsolete.
-  bcm2835_mmal_v4l2_camera_driver = rec {
-    name = "bcm2835_mmal_v4l2_camera_driver";
-    patch = fetchpatch {
-      name = name + ".patch";
-      url = https://patchwork.kernel.org/patch/9626797/raw/;
-      sha256 = "0iwb0yxsf95zv4qxkvlvhqfmzx0rk13g9clvxsharvwkb4w5lwa0";
-    };
-  };
-
   # https://github.com/NixOS/nixpkgs/issues/42755
   xen-netfront_fix_mismatched_rtnl_unlock = rec {
     name = "xen-netfront_fix_mismatched_rtnl_unlock";
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 121ac04bbc85..c060110f0eec 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -13842,7 +13842,6 @@ with pkgs;
         # when adding a new linux version
         # kernelPatches.cpu-cgroup-v2."4.11"
         kernelPatches.modinst_arg_list_too_long
-        kernelPatches.bcm2835_mmal_v4l2_camera_driver # Only needed for 4.16!
       ];
   };
 

From a2f499e21df9aa447e6a7af2be030a58447f877f Mon Sep 17 00:00:00 2001
From: Tuomas Tynkkynen <tuomas@tuxera.com>
Date: Mon, 6 Aug 2018 18:44:11 +0300
Subject: [PATCH 25/31] linux_testing: 4.18-rc7 -> 4.18-rc8

---
 pkgs/os-specific/linux/kernel/linux-testing.nix | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pkgs/os-specific/linux/kernel/linux-testing.nix b/pkgs/os-specific/linux/kernel/linux-testing.nix
index ec4d9c29dbc7..ec3baaf1e0a4 100644
--- a/pkgs/os-specific/linux/kernel/linux-testing.nix
+++ b/pkgs/os-specific/linux/kernel/linux-testing.nix
@@ -1,13 +1,13 @@
 { stdenv, buildPackages, hostPlatform, fetchurl, perl, buildLinux, libelf, utillinux, ... } @ args:
 
 buildLinux (args // rec {
-  version = "4.18-rc7";
-  modDirVersion = "4.18.0-rc7";
+  version = "4.18-rc8";
+  modDirVersion = "4.18.0-rc8";
   extraMeta.branch = "4.18";
 
   src = fetchurl {
     url = "https://git.kernel.org/torvalds/t/linux-${version}.tar.gz";
-    sha256 = "005kk7rxawkka60y31a5aiqrq3w6i1k27b5n2lcq63agjcxh54rq";
+    sha256 = "0rqyqms63c15iwcwy40yqd9fvlvh3ah09gddv0wf45z9dqp7id1m";
   };
 
   # Should the testing kernels ever be built on Hydra?

From 9934f0bb51afbee232f58fcdaac060c1dc48f0dd Mon Sep 17 00:00:00 2001
From: James Wood <jammyatjammy@gmail.com>
Date: Mon, 6 Aug 2018 17:39:11 +0100
Subject: [PATCH 26/31] AgdaStdlib: 0.15 -> 0.16 (#44550)

---
 pkgs/development/libraries/agda/agda-stdlib/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/libraries/agda/agda-stdlib/default.nix b/pkgs/development/libraries/agda/agda-stdlib/default.nix
index 331039ec329f..bd4270e8b935 100644
--- a/pkgs/development/libraries/agda/agda-stdlib/default.nix
+++ b/pkgs/development/libraries/agda/agda-stdlib/default.nix
@@ -1,14 +1,14 @@
 { stdenv, agda, fetchFromGitHub, ghcWithPackages }:
 
 agda.mkDerivation (self: rec {
-  version = "0.15";
+  version = "0.16";
   name = "agda-stdlib-${version}";
 
   src = fetchFromGitHub {
     repo = "agda-stdlib";
     owner = "agda";
     rev = "v${version}";
-    sha256 = "0c2vfib4fmljy98c3s3s7jmpjlqxvsbv7wf6qxr38kamwzbryrjj";
+    sha256 = "0kqfx6742vbyyr8glqm5bkvj0z0y0dkaajlw10p3pzidrc17767r";
   };
 
   nativeBuildInputs = [ (ghcWithPackages (self : [ self.filemanip ])) ];

From 9bf0ebac7e76cb03904d34dfd9512bb76d35f7b4 Mon Sep 17 00:00:00 2001
From: "Wael M. Nasreddine" <wael.nasreddine@gmail.com>
Date: Mon, 6 Aug 2018 10:13:01 -0700
Subject: [PATCH 27/31] tmux-plugins: fix the fzf-tmux-url derivation

---
 pkgs/misc/tmux-plugins/default.nix | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/pkgs/misc/tmux-plugins/default.nix b/pkgs/misc/tmux-plugins/default.nix
index 6d8a5a40c162..fc587d950c1c 100644
--- a/pkgs/misc/tmux-plugins/default.nix
+++ b/pkgs/misc/tmux-plugins/default.nix
@@ -3,13 +3,14 @@
 let
   rtpPath = "share/tmux-plugins";
 
-  addRtp = path: pluginName: attrs: derivation:
-    derivation // { rtp = "${derivation}/${path}/${builtins.replaceStrings ["-"] ["_"] pluginName}.tmux"; } // {
+  addRtp = path: rtpFilePath: attrs: derivation:
+    derivation // { rtp = "${derivation}/${path}/${rtpFilePath}"; } // {
       overrideAttrs = f: buildTmuxPlugin (attrs // f attrs);
     };
 
   buildTmuxPlugin = a@{
     pluginName,
+    rtpFilePath ? (builtins.replaceStrings ["-"] ["_"] pluginName) + ".tmux",
     namePrefix ? "tmuxplugin-",
     src,
     unpackPhase ? "",
@@ -22,7 +23,7 @@ let
     dependencies ? [],
     ...
   }:
-    addRtp "${rtpPath}/${path}" pluginName a (stdenv.mkDerivation (a // {
+    addRtp "${rtpPath}/${path}" rtpFilePath a (stdenv.mkDerivation (a // {
       name = namePrefix + pluginName;
 
       inherit pluginName unpackPhase configurePhase buildPhase addonInfo preInstall postInstall;
@@ -102,6 +103,7 @@ in rec {
 
   fzf-tmux-url = buildTmuxPluginFrom2Nix {
     pluginName = "fzf-tmux-url";
+    rtpFilePath = "fzf-url.tmux";
     src = fetchgit {
       url = "https://github.com/wfxr/tmux-fzf-url";
       rev = "ecd518eec1067234598c01e655b048ff9d06ef2f";

From 39335e69281a9382852a21397c9484e380522018 Mon Sep 17 00:00:00 2001
From: Tim Steinbach <tim@nequissimus.com>
Date: Mon, 6 Aug 2018 15:14:27 -0400
Subject: [PATCH 28/31] linux: 4.4.145 -> 4.4.146

---
 pkgs/os-specific/linux/kernel/linux-4.4.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/os-specific/linux/kernel/linux-4.4.nix b/pkgs/os-specific/linux/kernel/linux-4.4.nix
index 8bb2d53da9e0..60a4d5a76ed9 100644
--- a/pkgs/os-specific/linux/kernel/linux-4.4.nix
+++ b/pkgs/os-specific/linux/kernel/linux-4.4.nix
@@ -1,11 +1,11 @@
 { stdenv, buildPackages, hostPlatform, fetchurl, perl, buildLinux, ... } @ args:
 
 buildLinux (args // rec {
-  version = "4.4.145";
+  version = "4.4.146";
   extraMeta.branch = "4.4";
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
-    sha256 = "1max0d1b1y1ndrfprrcyb7c9y12pkx2whxzlr70qypcb5jz0v7ff";
+    sha256 = "1xbxw6yvbjam0xj8j44h730dpf5v94pcf9j7iivcmasgjp61120z";
   };
 } // (args.argsOverride or {}))

From 099671894d63536d1e716dc8d78382d0f1ccf8a1 Mon Sep 17 00:00:00 2001
From: Tim Steinbach <tim@nequissimus.com>
Date: Mon, 6 Aug 2018 15:14:40 -0400
Subject: [PATCH 29/31] linux: 4.9.117 -> 4.9.118

---
 pkgs/os-specific/linux/kernel/linux-4.9.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/os-specific/linux/kernel/linux-4.9.nix b/pkgs/os-specific/linux/kernel/linux-4.9.nix
index 231e24be9116..1863aadf8f1c 100644
--- a/pkgs/os-specific/linux/kernel/linux-4.9.nix
+++ b/pkgs/os-specific/linux/kernel/linux-4.9.nix
@@ -1,11 +1,11 @@
 { stdenv, buildPackages, hostPlatform, fetchurl, perl, buildLinux, ... } @ args:
 
 buildLinux (args // rec {
-  version = "4.9.117";
+  version = "4.9.118";
   extraMeta.branch = "4.9";
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
-    sha256 = "1c3r0a4fchg358zff2ww8kw789kah3bhr750p9qlsy65d8rflcl2";
+    sha256 = "0myx79rmxgjbr87r815vybmbg6iqgd3nycildrpwsh301kj8kxvx";
   };
 } // (args.argsOverride or {}))

From ecfc3d937317446d31c5c400e8820483f74a4d02 Mon Sep 17 00:00:00 2001
From: Tim Steinbach <tim@nequissimus.com>
Date: Mon, 6 Aug 2018 15:14:49 -0400
Subject: [PATCH 30/31] linux: 4.14.60 -> 4.14.61

---
 pkgs/os-specific/linux/kernel/linux-4.14.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/os-specific/linux/kernel/linux-4.14.nix b/pkgs/os-specific/linux/kernel/linux-4.14.nix
index d8040fbf3bf3..9c9957d21930 100644
--- a/pkgs/os-specific/linux/kernel/linux-4.14.nix
+++ b/pkgs/os-specific/linux/kernel/linux-4.14.nix
@@ -3,7 +3,7 @@
 with stdenv.lib;
 
 buildLinux (args // rec {
-  version = "4.14.60";
+  version = "4.14.61";
 
   # modDirVersion needs to be x.y.z, will automatically add .0 if needed
   modDirVersion = if (modDirVersionArg == null) then concatStrings (intersperse "." (take 3 (splitString "." "${version}.0"))) else modDirVersionArg;
@@ -13,6 +13,6 @@ buildLinux (args // rec {
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
-    sha256 = "15djfcl4m388vm3wkfa6yx0sglyp8zh04s7m7xa1ybmsiwjl7qbc";
+    sha256 = "1s3h3js073h4ww2dryip91d2lvmgv439ly2vya9x7rvilwhwa3hd";
   };
 } // (args.argsOverride or {}))

From 6b573157644352f712b4f5484cff286d9803efb9 Mon Sep 17 00:00:00 2001
From: Tim Steinbach <tim@nequissimus.com>
Date: Mon, 6 Aug 2018 15:15:00 -0400
Subject: [PATCH 31/31] linux: 4.17.12 -> 4.17.13

---
 pkgs/os-specific/linux/kernel/linux-4.17.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/os-specific/linux/kernel/linux-4.17.nix b/pkgs/os-specific/linux/kernel/linux-4.17.nix
index 6004577fad68..b98cf98904e5 100644
--- a/pkgs/os-specific/linux/kernel/linux-4.17.nix
+++ b/pkgs/os-specific/linux/kernel/linux-4.17.nix
@@ -3,7 +3,7 @@
 with stdenv.lib;
 
 buildLinux (args // rec {
-  version = "4.17.12";
+  version = "4.17.13";
 
   # modDirVersion needs to be x.y.z, will automatically add .0 if needed
   modDirVersion = if (modDirVersionArg == null) then concatStrings (intersperse "." (take 3 (splitString "." "${version}.0"))) else modDirVersionArg;
@@ -13,6 +13,6 @@ buildLinux (args // rec {
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
-    sha256 = "18xmkj1bmfrmvx6p8cl5l7pyv0zk5y3mxhyfnlzqwkxnvkjf5660";
+    sha256 = "0x1zas3jwvhjkifh20cwpd2g0glgr8m7h8lqng7awrd116xkw2w2";
   };
 } // (args.argsOverride or {}))