summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/applications/audio/adlplug/default.nix90
-rw-r--r--pkgs/applications/audio/munt/default.nix53
-rw-r--r--pkgs/applications/audio/openmpt123/default.nix15
-rw-r--r--pkgs/applications/audio/uade123/default.nix75
-rw-r--r--pkgs/applications/blockchains/faraday/default.nix8
-rw-r--r--pkgs/applications/misc/hubstaff/default.nix21
-rw-r--r--pkgs/applications/misc/hubstaff/revision.json5
-rwxr-xr-xpkgs/applications/misc/hubstaff/update.sh18
-rw-r--r--pkgs/applications/networking/browsers/chromium/upstream-info.json6
-rw-r--r--pkgs/applications/networking/instant-messengers/bluejeans/default.nix16
-rwxr-xr-xpkgs/applications/networking/instant-messengers/bluejeans/update.sh12
-rw-r--r--pkgs/development/libraries/libbencodetools/default.nix30
-rw-r--r--pkgs/development/ocaml-modules/tls/async.nix21
-rw-r--r--pkgs/development/ocaml-modules/tls/default.nix47
-rw-r--r--pkgs/development/ocaml-modules/tls/mirage.nix20
-rw-r--r--pkgs/development/python-modules/pyyaml-env-tag/default.nix36
-rw-r--r--pkgs/development/tools/documentation/mkdocs/default.nix61
-rw-r--r--pkgs/tools/audio/opl3bankeditor/0001-opl3bankeditor-Look-for-system-installed-Rt-libs.patch200
-rw-r--r--pkgs/tools/audio/opl3bankeditor/0001-opn2bankeditor-Look-for-system-installed-Rt-libs.patch200
-rw-r--r--pkgs/tools/audio/opl3bankeditor/common.nix69
-rw-r--r--pkgs/tools/audio/opl3bankeditor/default.nix30
-rw-r--r--pkgs/tools/audio/opl3bankeditor/opn2bankeditor.nix21
-rw-r--r--pkgs/tools/graphics/eplot/default.nix11
-rw-r--r--pkgs/top-level/all-packages.nix23
-rw-r--r--pkgs/top-level/ocaml-packages.nix2
-rw-r--r--pkgs/top-level/python-packages.nix2
26 files changed, 900 insertions, 192 deletions
diff --git a/pkgs/applications/audio/adlplug/default.nix b/pkgs/applications/audio/adlplug/default.nix
index 9b0fe1d80ff..a501cd0a1d8 100644
--- a/pkgs/applications/audio/adlplug/default.nix
+++ b/pkgs/applications/audio/adlplug/default.nix
@@ -1,19 +1,48 @@
-{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, libjack2, alsa-lib
-, freetype, libX11, libXrandr, libXinerama, libXext, libXcursor
-, fetchpatch, fmt
-, adlplugChip ? "-DADLplug_CHIP=OPL3"
-, pname ? "ADLplug" }:
+{ lib
+, stdenv
+, fetchFromGitHub
+, fetchpatch
+, cmake
+, pkg-config
+, fmt
+, liblo
+, alsa-lib
+, freetype
+, libX11
+, libXrandr
+, libXinerama
+, libXext
+, libXcursor
+, libobjc
+, Cocoa
+, CoreServices
+, WebKit
+, DiscRecording
 
+  # Enabling JACK requires a JACK server at runtime, no fallback mechanism
+, withJack ? false, jack
+
+, type ? "ADL"
+}:
+
+assert lib.assertOneOf "type" type [ "ADL" "OPN" ];
+let
+  chip = {
+    ADL = "OPL3";
+    OPN = "OPN2";
+  }.${type};
+  mainProgram = "${type}plug";
+in
 stdenv.mkDerivation rec {
-  inherit pname;
+  pname = "${lib.strings.toLower type}plug";
   version = "1.0.2";
 
   src = fetchFromGitHub {
     owner = "jpcima";
     repo = "ADLplug";
     rev = "v${version}";
-    sha256 = "0mqx4bzri8s880v7jwd24nb93m5i3aklqld0b3h0hjnz0lh2qz0f";
     fetchSubmodules = true;
+    sha256 = "0mqx4bzri8s880v7jwd24nb93m5i3aklqld0b3h0hjnz0lh2qz0f";
   };
 
   patches = [
@@ -25,19 +54,52 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  cmakeFlags = [ adlplugChip "-DADLplug_USE_SYSTEM_FMT=ON" ];
+  cmakeFlags = [
+    "-DADLplug_CHIP=${chip}"
+    "-DADLplug_USE_SYSTEM_FMT=ON"
+    "-DADLplug_Jack=${if withJack then "ON" else "OFF"}"
+  ];
+
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin (toString [
+    "-isystem ${CoreServices}/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers"
+  ]);
+
+  nativeBuildInputs = [
+    cmake
+    pkg-config
+  ];
 
   buildInputs = [
-    libjack2 alsa-lib freetype libX11 libXrandr libXinerama libXext
+    fmt
+    liblo
+  ] ++ lib.optionals stdenv.hostPlatform.isLinux [
+    alsa-lib
+    freetype
+    libX11
+    libXrandr
+    libXinerama
+    libXext
     libXcursor
-  ];
-  nativeBuildInputs = [ cmake pkg-config fmt ];
+  ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
+    libobjc
+    Cocoa
+    CoreServices
+    WebKit
+    DiscRecording
+  ] ++ lib.optional withJack jack;
+
+  postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
+    mkdir $out/Applications
+    mv $out/bin/${mainProgram}.app $out/Applications/
+    ln -s $out/{Applications/${mainProgram}.app/Contents/MacOS,bin}/${mainProgram}
+  '';
 
   meta = with lib; {
-    description = "OPL3 and OPN2 FM Chip Synthesizer";
+    inherit mainProgram;
+    description = "${chip} FM Chip Synthesizer";
     homepage = src.meta.homepage;
     license = licenses.boost;
-    platforms = platforms.linux;
-    maintainers = with maintainers; [ ];
+    platforms = platforms.all;
+    maintainers = with maintainers; [ OPNA2608 ];
   };
 }
diff --git a/pkgs/applications/audio/munt/default.nix b/pkgs/applications/audio/munt/default.nix
index 773a9178c0b..191612700f4 100644
--- a/pkgs/applications/audio/munt/default.nix
+++ b/pkgs/applications/audio/munt/default.nix
@@ -1,38 +1,51 @@
-{ lib, mkDerivation, fetchFromGitHub, cmake, qtbase, alsa-lib, makeDesktopItem, libjack2 }:
+{ lib
+, mkDerivation
+, stdenv
+, fetchFromGitHub
+, makeDesktopItem
+, cmake
+, pkg-config
+, qtbase
+, glib
+, alsa-lib
+, withJack ? stdenv.hostPlatform.isUnix, jack
+}:
 
 let
-  desktopItem = makeDesktopItem rec {
-    name = "Munt";
-    exec = "mt32emu-qt";
-    desktopName = name;
-    genericName = "Munt synthesiser";
-    categories = "Audio;AudioVideo;";
-  };
-in mkDerivation rec {
-  version = "2.4.1";
+  mainProgram = "mt32emu-qt";
+in
+mkDerivation rec {
   pname = "munt";
+  version = "2.5.0";
 
   src = fetchFromGitHub {
     owner = pname;
     repo = pname;
-    rev = with lib.versions; "libmt32emu_${major version}_${minor version}_${patch version}";
-    sha256 = "0bszhkbz24hhx32f973l6h5lkyn4lxhqrckiwmv765d1sba8n5bk";
+    rev = "munt_${lib.replaceChars [ "." ] [ "_" ] version}";
+    sha256 = "1lknq2a72gv1ddhzr7f967wpa12lh805jj4gjacdnamgrc1h22yn";
   };
 
-  postInstall = ''
-    ln -s ${desktopItem}/share/applications $out/share
-  '';
-
   dontFixCmake = true;
 
-  nativeBuildInputs = [ cmake ];
-  buildInputs = [ qtbase alsa-lib libjack2 ];
+  nativeBuildInputs = [ cmake pkg-config ];
+
+  buildInputs = [ qtbase glib ]
+    ++ lib.optional stdenv.hostPlatform.isLinux alsa-lib
+    ++ lib.optional withJack jack;
+
+  postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
+    mkdir $out/Applications
+    mv $out/bin/${mainProgram}.app $out/Applications/
+    wrapQtApp $out/Applications/${mainProgram}.app/Contents/MacOS/${mainProgram}
+    ln -s $out/{Applications/${mainProgram}.app/Contents/MacOS,bin}/${mainProgram}
+  '';
 
   meta = with lib; {
+    inherit mainProgram;
     description = "Multi-platform software synthesiser emulating Roland MT-32, CM-32L, CM-64 and LAPC-I devices";
     homepage = "http://munt.sourceforge.net/";
     license = with licenses; [ lgpl21 gpl3 ];
-    platforms = platforms.linux;
-    maintainers = with maintainers; [ ];
+    platforms = platforms.all;
+    maintainers = with maintainers; [ OPNA2608 ];
   };
 }
diff --git a/pkgs/applications/audio/openmpt123/default.nix b/pkgs/applications/audio/openmpt123/default.nix
index a5ea91141c3..5d188889516 100644
--- a/pkgs/applications/audio/openmpt123/default.nix
+++ b/pkgs/applications/audio/openmpt123/default.nix
@@ -1,19 +1,16 @@
 { config, lib, stdenv, fetchurl, zlib, pkg-config, mpg123, libogg, libvorbis, portaudio, libsndfile, flac
 , usePulseAudio ? config.pulseaudio or false, libpulseaudio }:
 
-let
-  version = "0.5.8";
-in stdenv.mkDerivation {
+stdenv.mkDerivation rec {
   pname = "openmpt123";
-  inherit version;
+  version = "0.5.9";
 
   src = fetchurl {
     url = "https://lib.openmpt.org/files/libopenmpt/src/libopenmpt-${version}+release.autotools.tar.gz";
-    sha256 = "sha256-KeLCEXS3P2fyul7naAjWLxgrEw5PcE7i2a6Cg5gtis0=";
+    sha256 = "0h86p8mnpm98vc4v6jbvrmm02fch7dnn332i26fg3a2s1738m04d";
   };
 
   enableParallelBuilding = true;
-  doCheck = true;
 
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ zlib mpg123 libogg libvorbis portaudio libsndfile flac ]
@@ -21,11 +18,13 @@ in stdenv.mkDerivation {
 
   configureFlags = lib.optional (!usePulseAudio) "--without-pulseaudio";
 
+  doCheck = true;
+
   meta = with lib; {
     description = "A cross-platform command-line based module file player";
     homepage = "https://lib.openmpt.org/libopenmpt/";
     license = licenses.bsd3;
-    maintainers = with maintainers; [ ];
-    platforms = platforms.linux;
+    maintainers = with maintainers; [ OPNA2608 ];
+    platforms = platforms.unix;
   };
 }
diff --git a/pkgs/applications/audio/uade123/default.nix b/pkgs/applications/audio/uade123/default.nix
index 271f9f912ea..8191fd381a4 100644
--- a/pkgs/applications/audio/uade123/default.nix
+++ b/pkgs/applications/audio/uade123/default.nix
@@ -1,25 +1,74 @@
-{ lib, stdenv, fetchurl, which, libao, pkg-config }:
+{ lib
+, stdenv
+, fetchFromGitLab
+, pkg-config
+, which
+, makeWrapper
+, libao
+, libbencodetools
+, sox
+, lame
+, flac
+, vorbis-tools
+}:
 
-let
-  version = "2.13";
-in stdenv.mkDerivation {
+stdenv.mkDerivation {
   pname = "uade123";
-  inherit version;
-  src = fetchurl {
-    url = "http://zakalwe.fi/uade/uade2/uade-${version}.tar.bz2";
-    sha256 = "04nn5li7xy4g5ysyjjngmv5d3ibxppkbb86m10vrvadzxdd4w69v";
+  version = "unstable-2021-05-21";
+
+  src = fetchFromGitLab {
+    owner = "uade-music-player";
+    repo = "uade";
+    rev = "7169a46e777d19957cd7ff8ac31843203e725ddc";
+    sha256 = "1dm7c924fy79y3wkb0qi71m1k6yw1x6j3whw7d0w4ka9hv6za03b";
   };
-  nativeBuildInputs = [ pkg-config which ];
-  buildInputs = [ libao ];
+
+  postPatch = ''
+    patchShebangs .
+    substituteInPlace src/frontends/mod2ogg/mod2ogg2.sh.in \
+      --replace '-e stat' '-n stat' \
+      --replace '/usr/local' "$out"
+  '';
+
+  nativeBuildInputs = [
+    pkg-config
+    which
+    makeWrapper
+  ];
+
+  buildInputs = [
+    libao
+    libbencodetools
+    sox
+    lame
+    flac
+    vorbis-tools
+  ];
+
+  configureFlags = [
+    "--bencode-tools-prefix=${libbencodetools}"
+  ];
 
   enableParallelBuilding = true;
+
   hardeningDisable = [ "format" ];
 
+  postInstall = ''
+    wrapProgram $out/bin/mod2ogg2.sh \
+      --prefix PATH : $out/bin:${lib.makeBinPath [ sox lame flac vorbis-tools ]}
+    # This is an old script, don't break expectations by renaming it
+    ln -s $out/bin/mod2ogg2{.sh,}
+  '';
+
   meta = with lib; {
     description = "Plays old Amiga tunes through UAE emulation and cloned m68k-assembler Eagleplayer API";
-    homepage = "http://zakalwe.fi/uade/";
-    license = licenses.gpl2;
-    maintainers = [ ];
+    homepage = "https://zakalwe.fi/uade/";
+    # It's a mix of licenses. "GPL", Public Domain, "LGPL", GPL2+, BSD, LGPL21+ and source code with unknown licenses. E.g.
+    # - hippel-coso player is "[not] under any Open Source certified license"
+    # - infogrames player is disassembled from Andi Silvas player, unknown license
+    # Let's make it easy and flag the whole package as unfree.
+    license = licenses.unfree;
+    maintainers = with maintainers; [ OPNA2608 ];
     platforms = platforms.unix;
   };
 }
diff --git a/pkgs/applications/blockchains/faraday/default.nix b/pkgs/applications/blockchains/faraday/default.nix
index 90d76e29b6b..76e91f2bbe5 100644
--- a/pkgs/applications/blockchains/faraday/default.nix
+++ b/pkgs/applications/blockchains/faraday/default.nix
@@ -5,16 +5,16 @@
 
 buildGoModule rec {
   pname = "faraday";
-  version = "0.2.3-alpha";
+  version = "0.2.5-alpha";
 
   src = fetchFromGitHub {
     owner = "lightninglabs";
     repo = "faraday";
     rev = "v${version}";
-    sha256 = "16cqaslsbwda23b5n0sfppybd3ma4ch545100ydxrwac4zhrq4kq";
+    sha256 = "16mz333a6awii6g46gr597j31jmgws4285s693q0b87fl1ggj2zz";
   };
 
-  vendorSha256 = "1hh99nfprlmhkc36arg3w1kxby59i2l7n258cp40niv7bjn37hrq";
+  vendorSha256 = "1nclmvypxp5436q6qaagp1k5bfmaia7hsykw47va0pijlsvsbmck";
 
   subPackages = [ "cmd/frcli" "cmd/faraday" ];
 
@@ -22,6 +22,6 @@ buildGoModule rec {
     description = "LND Channel Management Tools";
     homepage = "https://github.com/lightninglabs/faraday";
     license = licenses.mit;
-    maintainers = with maintainers; [ proofofkeags ];
+    maintainers = with maintainers; [ proofofkeags prusnak ];
   };
 }
diff --git a/pkgs/applications/misc/hubstaff/default.nix b/pkgs/applications/misc/hubstaff/default.nix
index f291ab898e3..1bc22b6613d 100644
--- a/pkgs/applications/misc/hubstaff/default.nix
+++ b/pkgs/applications/misc/hubstaff/default.nix
@@ -1,13 +1,12 @@
 { lib, stdenv, fetchurl, unzip, makeWrapper, libX11, zlib, libSM, libICE
 , libXext , freetype, libXrender, fontconfig, libXft, libXinerama
 , libXfixes, libXScrnSaver, libnotify, glib , gtk3, libappindicator-gtk3
-, curl }:
+, curl, writeShellScript, common-updater-scripts }:
 
 let
-
-  data = builtins.fromJSON (builtins.readFile ./revision.json);
-
-  inherit (data) version url sha256;
+  url = "https://hubstaff-production.s3.amazonaws.com/downloads/HubstaffClient/Builds/Release/1.5.19-9e79d1da/Hubstaff-1.5.19-9e79d1da.sh";
+  version = "1.5.19-9e79d1da";
+  sha256 = "1l4sq8cblpl1kclkx5pgy0ldfmqa3n8bvdl5qml0n78r0lpk382j";
 
   rpath = lib.makeLibraryPath
     [ libX11 zlib libSM libICE libXext freetype libXrender fontconfig libXft
@@ -56,6 +55,18 @@ stdenv.mkDerivation {
     ln -s $opt/data/resources $opt/x86_64/resources
   '';
 
+  updateScript = writeShellScript "hubstaff-updater" ''
+    set -eu -o pipefail
+
+    installation_script_url=$(curl --fail --head --location --silent --output /dev/null --write-out %{url_effective} https://app.hubstaff.com/download/linux)
+
+    version=$(echo "$installation_script_url" | sed -r 's/^https:\/\/hubstaff\-production\.s3\.amazonaws\.com\/downloads\/HubstaffClient\/Builds\/Release\/([^\/]+)\/Hubstaff.+$/\1/')
+
+    sha256=$(nix-prefetch-url "$installation_script_url")
+
+    ${common-updater-scripts}/bin/update-source-version hubstaff "$version" "$sha256" "$installation_script_url"
+  '';
+
   meta = with lib; {
     description = "Time tracking software";
     homepage = "https://hubstaff.com/";
diff --git a/pkgs/applications/misc/hubstaff/revision.json b/pkgs/applications/misc/hubstaff/revision.json
deleted file mode 100644
index 9b0ffe67f0c..00000000000
--- a/pkgs/applications/misc/hubstaff/revision.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
-  "url": "https://hubstaff-production.s3.amazonaws.com/downloads/HubstaffClient/Builds/Release/1.5.15-28673d1c/Hubstaff-1.5.15-28673d1c.sh",
-  "version": "1.5.15-28673d1c",
-  "sha256": "0ging41l3a3sdj6bggh913h71gqmb8l3rplp4civpgclnfzv7fg2"
-}
diff --git a/pkgs/applications/misc/hubstaff/update.sh b/pkgs/applications/misc/hubstaff/update.sh
deleted file mode 100755
index c4c1caf55db..00000000000
--- a/pkgs/applications/misc/hubstaff/update.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/bin/env nix-shell
-#!nix-shell -i bash -p nix-prefetch-git curl
-
-SCRIPT_DIR=$(dirname "$(readlink -f "$BASH_SOURCE")")
-
-installation_script_url=$(curl --fail --head --location --silent --output /dev/null --write-out %{url_effective} https://app.hubstaff.com/download/linux)
-
-version=$(echo "$installation_script_url" | sed -r 's/^https:\/\/hubstaff\-production\.s3\.amazonaws\.com\/downloads\/HubstaffClient\/Builds\/Release\/([^\/]+)\/Hubstaff.+$/\1/')
-
-sha256=$(nix-prefetch-url "$installation_script_url")
-
-cat <<EOT > $SCRIPT_DIR/revision.json
-{
-  "url": "$installation_script_url",
-  "version": "$version",
-  "sha256": "$sha256"
-}
-EOT
diff --git a/pkgs/applications/networking/browsers/chromium/upstream-info.json b/pkgs/applications/networking/browsers/chromium/upstream-info.json
index 717bda8a297..377dd17afaa 100644
--- a/pkgs/applications/networking/browsers/chromium/upstream-info.json
+++ b/pkgs/applications/networking/browsers/chromium/upstream-info.json
@@ -1,8 +1,8 @@
 {
   "stable": {
-    "version": "91.0.4472.106",
-    "sha256": "1fxy1l2dl0f6v8566lykcng18ma6fv4nlwxmdb0hh06fgp6khpjl",
-    "sha256bin64": "11l88fqrl1r7b02j78zgrr6kajayl8kw8mb8b91ard18w5kz1xvd",
+    "version": "91.0.4472.114",
+    "sha256": "0wbyiwbdazgjjgj9vs56x26q3g9r80a57gfl0f2rfl1j7xwgxiy1",
+    "sha256bin64": "00ac1dyqxpxy1j11jvc5j35bgc629n2f2pll3912gzih4ir0vrys",
     "deps": {
       "gn": {
         "version": "2021-04-06",
diff --git a/pkgs/applications/networking/instant-messengers/bluejeans/default.nix b/pkgs/applications/networking/instant-messengers/bluejeans/default.nix
index 6e57e0e9423..adc19f5dcfd 100644
--- a/pkgs/applications/networking/instant-messengers/bluejeans/default.nix
+++ b/pkgs/applications/networking/instant-messengers/bluejeans/default.nix
@@ -38,14 +38,17 @@
 , xdg-utils
 }:
 
+let
+  getFirst = n: v: builtins.concatStringsSep "." (lib.take n (lib.splitString "." v));
+in
+
 stdenv.mkDerivation rec {
   pname = "bluejeans";
-  version = "2.21.3";
-  buildNumber = "2";
+  version = "2.22.0.87";
 
   src = fetchurl {
-    url = "https://swdl.bluejeans.com/desktop-app/linux/${version}/BlueJeans_${version}.${buildNumber}.rpm";
-    sha256 = "sha256-a/REuxkqZmLLa7N3CUgUAdq74VMD9D10a/Sx2jOj1QA=";
+    url = "https://swdl.bluejeans.com/desktop-app/linux/${getFirst 3 version}/BlueJeans_${version}.rpm";
+    sha256 = "sha256-0nobn+YcvqakwvBdkoEJrzHoL+OGym2zJ806oUabYfo=";
   };
 
   nativeBuildInputs = [ rpmextract makeWrapper ];
@@ -106,7 +109,7 @@ stdenv.mkDerivation rec {
       --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
       opt/BlueJeans/resources/BluejeansHelper
 
-    cc $localtime64_stub -shared -o "$out"/opt/BlueJeans/liblocaltime64_stub.so
+    cc $localtime64_stub -shared -o "${placeholder "out"}"/opt/BlueJeans/liblocaltime64_stub.so
 
     makeWrapper $out/opt/BlueJeans/bluejeans-v2 $out/bin/bluejeans \
       --set LD_LIBRARY_PATH "${libPath}":"${placeholder "out"}"/opt/BlueJeans \
@@ -119,6 +122,8 @@ stdenv.mkDerivation rec {
     patchShebangs "$out"
   '';
 
+  passthru.updateScript = ./update.sh;
+
   meta = with lib; {
     description = "Video, audio, and web conferencing that works together with the collaboration tools you use every day";
     homepage = "https://www.bluejeans.com";
@@ -127,3 +132,4 @@ stdenv.mkDerivation rec {
     platforms = [ "x86_64-linux" ];
   };
 }
+
diff --git a/pkgs/applications/networking/instant-messengers/bluejeans/update.sh b/pkgs/applications/networking/instant-messengers/bluejeans/update.sh
new file mode 100755
index 00000000000..2c527462003
--- /dev/null
+++ b/pkgs/applications/networking/instant-messengers/bluejeans/update.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env nix-shell
+#!nix-shell -i bash -p curl pup common-updater-scripts
+
+set -eu -o pipefail
+
+version="$(curl -Ls https://www.bluejeans.com/download | \
+    pup 'a[aria-label~="Linux"] attr{href}' | \
+    #output contains *.deb and *.rpm
+    grep "\.rpm" | \
+    awk -F'[ ._ ]' '{printf $6"."$7"."$8"."$9"\n"}')"
+
+update-source-version bluejeans-gui "$version"
diff --git a/pkgs/development/libraries/libbencodetools/default.nix b/pkgs/development/libraries/libbencodetools/default.nix
new file mode 100644
index 00000000000..b8150a90f68
--- /dev/null
+++ b/pkgs/development/libraries/libbencodetools/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, lib, fetchFromGitLab
+}:
+
+stdenv.mkDerivation rec {
+  pname = "libbencodetools";
+  version = "unstable-2021-04-15";
+
+  src = fetchFromGitLab {
+    owner = "heikkiorsila";
+    repo = "bencodetools";
+    rev = "1ab11f6509a348975e8aec829d7abbf2f8e9b7d1";
+    sha256 = "1i2dgvxxwj844yn45hnfx3785ljbvbkri0nv0jx51z4i08w7cz0h";
+  };
+
+  postPatch = ''
+    patchShebangs .
+  '';
+
+  configureFlags = [
+    "--without-python"
+  ];
+
+  meta = with lib; {
+    description = "Collection of tools for manipulating bencoded data";
+    homepage = "https://gitlab.com/heikkiorsila/bencodetools";
+    license = licenses.bsd2;
+    maintainers = with maintainers; [ OPNA2608 ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/pkgs/development/ocaml-modules/tls/async.nix b/pkgs/development/ocaml-modules/tls/async.nix
new file mode 100644
index 00000000000..ceac7a7c074
--- /dev/null
+++ b/pkgs/development/ocaml-modules/tls/async.nix
@@ -0,0 +1,21 @@
+{ lib, buildDunePackage, tls, async, cstruct-async, core, cstruct, mirage-crypto-rng-async }:
+
+buildDunePackage rec {
+  pname = "tls-async";
+
+  inherit (tls) src meta version;
+
+  minimumOCamlVersion = "4.08";
+  useDune2 = true;
+
+  doCheck = true;
+
+  propagatedBuildInputs = [
+    async
+    core
+    cstruct
+    cstruct-async
+    mirage-crypto-rng-async
+    tls
+  ];
+}
diff --git a/pkgs/development/ocaml-modules/tls/default.nix b/pkgs/development/ocaml-modules/tls/default.nix
index dadeb5a98ea..5a5479c9fe8 100644
--- a/pkgs/development/ocaml-modules/tls/default.nix
+++ b/pkgs/development/ocaml-modules/tls/default.nix
@@ -1,28 +1,47 @@
-{ lib, fetchurl, buildDunePackage, ppx_sexp_conv, ppx_cstruct, cstruct
-, cstruct-sexp, sexplib, mirage-crypto, mirage-crypto-pk, mirage-crypto-rng
-, x509, domain-name, fmt, cstruct-unix, ounit2, ocaml_lwt, ptime, rresult
-, mirage-crypto-ec, hkdf, logs, alcotest }:
+{ lib, fetchurl, buildDunePackage
+, cstruct, cstruct-sexp, domain-name, fmt, ppx_cstruct, ppx_sexp_conv, logs, hkdf, mirage-crypto, mirage-crypto-ec, mirage-crypto-pk, mirage-crypto-rng, ocaml_lwt, ptime, rresult, sexplib, x509
+, alcotest, cstruct-unix, ounit2, randomconv
+}:
 
 buildDunePackage rec {
-  minimumOCamlVersion = "4.08";
-
-  version = "0.13.1";
   pname = "tls";
+  version = "0.13.2";
 
   src = fetchurl {
     url = "https://github.com/mirleft/ocaml-tls/releases/download/v${version}/tls-v${version}.tbz";
-    sha256 = "ca95fa59a82f7d38b0b495fc0cd1ff54e7728492a292895d0067c1ba9de81b7b";
+    sha256 = "sha256-IE6Fuvem8A3lZ/M8GLNYNwCG+v7BbPQ4QdYS+fKT50c=";
   };
 
+  minimumOCamlVersion = "4.08";
   useDune2 = true;
 
-  doCheck = true;
-  checkInputs = [ cstruct-unix ounit2 alcotest ];
+  propagatedBuildInputs = [
+    cstruct
+    cstruct-sexp
+    domain-name
+    fmt
+    ppx_cstruct
+    ppx_sexp_conv
+    logs
+    hkdf
+    mirage-crypto
+    mirage-crypto-ec
+    mirage-crypto-pk
+    mirage-crypto-rng
+    ocaml_lwt
+    ptime
+    rresult
+    sexplib
+    x509
+  ];
 
-  propagatedBuildInputs = [ ppx_sexp_conv ppx_cstruct cstruct cstruct-sexp
-                            sexplib mirage-crypto mirage-crypto-pk mirage-crypto-rng
-                            x509 domain-name fmt ocaml_lwt ptime mirage-crypto-ec
-                            hkdf logs rresult ];
+  doCheck = true;
+  checkInputs = [
+    alcotest
+    cstruct-unix
+    ounit2
+    randomconv
+  ];
 
   meta = with lib; {
     homepage = "https://github.com/mirleft/ocaml-tls";
diff --git a/pkgs/development/ocaml-modules/tls/mirage.nix b/pkgs/development/ocaml-modules/tls/mirage.nix
index 18d0f08357d..a0428536b81 100644
--- a/pkgs/development/ocaml-modules/tls/mirage.nix
+++ b/pkgs/development/ocaml-modules/tls/mirage.nix
@@ -1,25 +1,23 @@
 { buildDunePackage, tls
-, x509, lwt, fmt, mirage-flow, mirage-kv, mirage-clock, ptime
-, mirage-crypto, mirage-crypto-pk, mirage-crypto-ec
+, fmt, lwt, mirage-clock, mirage-crypto, mirage-crypto-ec, mirage-crypto-pk, mirage-flow, mirage-kv, ptime, x509
 }:
 
 buildDunePackage {
   pname = "tls-mirage";
-
-  inherit (tls) version src useDune2 minimumOCamlVersion;
+  inherit (tls) src version minimumOCamlVersion useDune2;
 
   propagatedBuildInputs = [
-    tls
-    x509
-    lwt
     fmt
-    mirage-flow
-    mirage-kv
+    lwt
     mirage-clock
-    ptime
     mirage-crypto
-    mirage-crypto-pk
     mirage-crypto-ec
+    mirage-crypto-pk
+    mirage-flow
+    mirage-kv
+    ptime
+    tls
+    x509
   ];
 
   meta = tls.meta // {
diff --git a/pkgs/development/python-modules/pyyaml-env-tag/default.nix b/pkgs/development/python-modules/pyyaml-env-tag/default.nix
new file mode 100644
index 00000000000..f81bbbd7acb
--- /dev/null
+++ b/pkgs/development/python-modules/pyyaml-env-tag/default.nix
@@ -0,0 +1,36 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, pythonOlder
+, pyyaml
+, pytestCheckHook
+}:
+
+buildPythonPackage rec {
+  pname = "pyyaml-env-tag";
+  version = "0.1";
+  disabled = pythonOlder "3.6";
+
+  src = fetchPypi {
+    pname = "pyyaml_env_tag";
+    inherit version;
+    sha256 = "1nsva88jsmwn0cb9jnrfiz4dvs9xakkpgfii7g1xwkx1pmsjc2bh";
+  };
+
+  propagatedBuildInputs = [
+    pyyaml
+  ];
+
+  checkInputs = [
+    pytestCheckHook
+  ];
+
+  pythonImportsCheck = [ "yaml_env_tag" ];
+
+  meta = with lib; {
+    description = "Custom YAML tag for referencing environment variables";
+    homepage = "https://github.com/waylan/pyyaml-env-tag";
+    license = with licenses; [ mit ];
+    maintainers = with maintainers; [ fab ];
+  };
+}
diff --git a/pkgs/development/tools/documentation/mkdocs/default.nix b/pkgs/development/tools/documentation/mkdocs/default.nix
index 64d834f1bb2..f7774cc7127 100644
--- a/pkgs/development/tools/documentation/mkdocs/default.nix
+++ b/pkgs/development/tools/documentation/mkdocs/default.nix
@@ -1,40 +1,55 @@
-{ lib, python3, fetchFromGitHub }:
+{ lib
+, python3
+, fetchFromGitHub
+}:
 
 with python3.pkgs;
 
 buildPythonApplication rec {
   pname = "mkdocs";
-  version = "1.0.4";
+  version = "1.2.1";
+  disabled = pythonOlder "3.6";
 
   src = fetchFromGitHub {
-    owner = "mkdocs";
-    repo = "mkdocs";
+    owner = pname;
+    repo = pname;
     rev = version;
-    sha256 = "1x35vgiskgz4wwrvi4m1mri5wlphf15p90fr3rxsy5bf19v3s9hs";
+    sha256 = "sha256-JF3Zz1ObxeKsIF0pa8duJxqjLgMvmWsWMApHT43Z+EY=";
   };
 
-  checkInputs = [
-    nose nose-exclude mock
+  propagatedBuildInputs = [
+    click
+    jinja2
+    markdown
+    mergedeep
+    pyyaml
+    pyyaml-env-tag
+    ghp-import
+    importlib-metadata
+    watchdog
+    packaging
   ];
 
-  NOSE_EXCLUDE_TESTS = lib.concatStringsSep ";" [
-    "mkdocs.tests.gh_deploy_tests.TestGitHubDeploy"
-    "mkdocs.tests.config.config_tests.ConfigTests"
-    "mkdocs.tests.config.config_options_tests.DirTest"
+  checkInputs = [
+    Babel
+    mock
+    pytestCheckHook
   ];
 
-  checkPhase = "nosetests mkdocs";
+  postPatch = ''
+    # Remove test due to missing requirement
+    rm mkdocs/tests/theme_tests.py
+  '';
 
-  propagatedBuildInputs = [
-    tornado
-    livereload
-    click
-    pyyaml
-    markdown
-    jinja2
-    backports_tempfile
+  pytestFlagsArray = [ "mkdocs/tests/*.py" ];
+
+  disabledTests = [
+    # Don't start a test server
+    "testing_server"
   ];
 
+  pythonImportsCheck = [ "mkdocs" ];
+
   meta = with lib; {
     description = "Project documentation with Markdown / static website generator";
     longDescription = ''
@@ -42,11 +57,11 @@ buildPythonApplication rec {
       geared towards building project documentation. Documentation source files
       are written in Markdown, and configured with a single YAML configuration file.
 
-      MkDocs can also be used to generate general-purpose Websites.
+      MkDocs can also be used to generate general-purpose websites.
     '';
     homepage = "http://mkdocs.org/";
-    license = lib.licenses.bsd2;
+    license = licenses.bsd2;
     platforms = platforms.unix;
-    maintainers = [ maintainers.rkoe ];
+    maintainers = with maintainers; [ rkoe ];
   };
 }
diff --git a/pkgs/tools/audio/opl3bankeditor/0001-opl3bankeditor-Look-for-system-installed-Rt-libs.patch b/pkgs/tools/audio/opl3bankeditor/0001-opl3bankeditor-Look-for-system-installed-Rt-libs.patch
new file mode 100644
index 00000000000..36adff53a01
--- /dev/null
+++ b/pkgs/tools/audio/opl3bankeditor/0001-opl3bankeditor-Look-for-system-installed-Rt-libs.patch
@@ -0,0 +1,200 @@
+From 11711398a1ec16f4eaeac8523b77165a560b69cc Mon Sep 17 00:00:00 2001
+From: OPNA2608 <christoph.neidahl@gmail.com>
+Date: Sun, 13 Jun 2021 13:55:53 +0200
+Subject: [PATCH] Look for system-installed Rt libs
+
+---
+ CMakeLists.txt | 159 +++++++++++++++++++++++++++++++------------------
+ 1 file changed, 102 insertions(+), 57 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f3e53c3..027c1b1 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -50,15 +50,6 @@ message("!! Optional feature summary:")
+ message("!!   RtMidi: ${USE_RTMIDI}")
+ message("!!   RtAudio: ${USE_RTAUDIO}")
+ 
+-if(USE_RTAUDIO)
+-  if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+-    pkg_check_modules(JACK "jack")
+-    message("!!   -- Jack driver: ${JACK_FOUND}")
+-    pkg_check_modules(PULSEAUDIO "libpulse-simple")
+-    message("!!   -- Pulseaudio driver: ${PULSEAUDIO_FOUND}")
+-  endif()
+-endif()
+-
+ if(ENABLE_PLOTS)
+   message("!!   Qwt: ${QWT_LIBRARY}")
+ endif()
+@@ -250,65 +241,119 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ endif()
+ 
+ if(USE_RTMIDI)
+-  add_library(RtMidi STATIC "src/midi/external/rtmidi/RtMidi.cpp")
+-  target_include_directories(RtMidi PUBLIC "src/midi/external/rtmidi")
+-  if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+-    target_compile_definitions(RtMidi PUBLIC "__LINUX_ALSA__")
+-    target_link_libraries(RtMidi PUBLIC "asound")
+-  elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+-    target_compile_definitions(RtMidi PUBLIC "__WINDOWS_MM__")
+-    target_link_libraries(RtMidi PUBLIC "winmm")
+-  elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+-    target_compile_definitions(RtMidi PUBLIC "__MACOSX_CORE__")
+-    find_library(COREMIDI_LIBRARY "CoreMIDI")
+-    target_link_libraries(RtMidi PUBLIC "${COREMIDI_LIBRARY}")
++  if(PKG_CONFIG_FOUND)
++    pkg_check_modules(RTMIDI rtmidi)
++    if(RTMIDI_FOUND)
++      message("Using system-installed RtMidi found by pkg-config.")
++      target_link_libraries(OPL3BankEditor PUBLIC ${RTMIDI_LDFLAGS})
++      target_include_directories(OPL3BankEditor PUBLIC ${RTMIDI_INCLUDE_DIRS})
++      target_compile_options(OPL3BankEditor PUBLIC ${RTMIDI_CFLAGS})
++    endif()
+   endif()
++
++  if(NOT RTMIDI_FOUND)
++    find_library(RTMIDI_LIBRARY "rtmidi")
++    find_path(RTMIDI_INCLUDE_DIRS "RtMidi.h")
++    message("RtMidi library: ${RTMIDI_LIBRARY}")
++    message("RtMidi header directory: ${RTMIDI_INCLUDE_DIRS}")
++    if(NOT RTMIDI_LIBRARY-NOTFOUND AND NOT RTMIDI_INCLUDE_DIRS STREQUAL RTMIDI_INCLUDE_DIRS-NOTFOUND)
++      message("Using system-installed RtMidi.")
++      set(RTMIDI_FOUND TRUE)
++      target_link_libraries(OPL3BankEditor PUBLIC ${RTMIDI_LIBRARY})
++      target_include_directories(OPL3BankEditor PUBLIC ${RTMIDI_INCLUDE_DIRS})
++    endif()
++  endif()
++
++  if(NOT RTMIDI_FOUND)
++    message("Using bundled RtMidi.")
++    add_library(RtMidi STATIC "src/midi/external/rtmidi/RtMidi.cpp")
++    target_include_directories(RtMidi PUBLIC "src/midi/external/rtmidi")
++    if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
++      target_compile_definitions(RtMidi PUBLIC "__LINUX_ALSA__")
++      target_link_libraries(RtMidi PUBLIC "asound")
++    elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
++      target_compile_definitions(RtMidi PUBLIC "__WINDOWS_MM__")
++      target_link_libraries(RtMidi PUBLIC "winmm")
++    elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
++      target_compile_definitions(RtMidi PUBLIC "__MACOSX_CORE__")
++      find_library(COREMIDI_LIBRARY "CoreMIDI")
++      target_link_libraries(RtMidi PUBLIC "${COREMIDI_LIBRARY}")
++    endif()
++    target_link_libraries(OPL3BankEditor PRIVATE RtMidi)
++  endif()
++
+   target_sources(OPL3BankEditor PRIVATE "src/midi/midi_rtmidi.cpp")
+   target_compile_definitions(OPL3BankEditor PRIVATE "ENABLE_MIDI")
+-  target_link_libraries(OPL3BankEditor PRIVATE RtMidi)
+ endif()
+ 
+ if(USE_RTAUDIO)
+-  add_library(RtAudio STATIC "src/audio/external/rtaudio/RtAudio.cpp")
+-  target_include_directories(RtAudio PUBLIC "src/audio/external/rtaudio")
+-  if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+-    target_compile_definitions(RtAudio PUBLIC "__LINUX_ALSA__")
+-    target_link_libraries(RtAudio PUBLIC "asound")
+-    if(JACK_FOUND)
+-      target_compile_definitions(RtAudio PUBLIC "__UNIX_JACK__")
+-      target_include_directories(RtAudio PUBLIC ${JACK_INCLUDE_DIRS})
+-      link_directories(${JACK_LIBRARY_DIRS})
+-      target_link_libraries(RtAudio PUBLIC ${JACK_LIBRARIES})
++  if(PKG_CONFIG_FOUND)
++    pkg_check_modules(RTAUDIO rtaudio)
++    if(RTAUDIO_FOUND)
++      message("Using system-installed RtAudio found by pkg-config.")
++      target_link_libraries(OPL3BankEditor PUBLIC ${RTAUDIO_LDFLAGS})
++      target_include_directories(OPL3BankEditor PUBLIC ${RTAUDIO_INCLUDE_DIRS})
++      target_compile_options(OPL3BankEditor PUBLIC ${RTAUDIO_CFLAGS})
++    endif()
++  endif()
++
++  if(NOT RTAUDIO_FOUND)
++    find_library(RTAUDIO_LIBRARY "rtaudio")
++    find_path(RTAUDIO_INCLUDE_DIRS "RtAudio.h")
++    message("RtAudio library: ${RTAUDIO_LIBRARY}")
++    message("RtAudio header directory: ${RTAUDIO_INCLUDE_DIRS}")
++    if(NOT RTAUDIO_LIBRARY-NOTFOUND AND NOT RTAUDIO_INCLUDE_DIRS STREQUAL RTAUDIO_INCLUDE_DIRS-NOTFOUND)
++      message("Using system-installed RtAudio.")
++      set(RTAUDIO_FOUND TRUE)
++      target_link_libraries(OPL3BankEditor PUBLIC ${RTAUDIO_LIBRARY})
++      target_include_directories(OPL3BankEditor PUBLIC ${RTAUDIO_INCLUDE_DIRS})
+     endif()
+-    if(PULSEAUDIO_FOUND)
+-      target_compile_definitions(RtAudio PUBLIC "__LINUX_PULSE__")
+-      target_include_directories(RtAudio PUBLIC ${PULSEAUDIO_INCLUDE_DIRS})
+-      link_directories(${PULSEAUDIO_LIBRARY_DIRS})
+-      target_link_libraries(RtAudio PUBLIC ${PULSEAUDIO_LIBRARIES})
++  endif()
++
++  if(NOT RTAUDIO_FOUND)
++    message("Using bundled RtAudio.")
++    add_library(RtAudio STATIC "src/audio/external/rtaudio/RtAudio.cpp")
++    target_include_directories(RtAudio PUBLIC "src/audio/external/rtaudio")
++    if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
++      target_compile_definitions(RtAudio PUBLIC "__LINUX_ALSA__")
++      target_link_libraries(RtAudio PUBLIC "asound")
++      if(JACK_FOUND)
++        target_compile_definitions(RtAudio PUBLIC "__UNIX_JACK__")
++        target_include_directories(RtAudio PUBLIC ${JACK_INCLUDE_DIRS})
++        link_directories(${JACK_LIBRARY_DIRS})
++        target_link_libraries(RtAudio PUBLIC ${JACK_LIBRARIES})
++      endif()
++      if(PULSEAUDIO_FOUND)
++        target_compile_definitions(RtAudio PUBLIC "__LINUX_PULSE__")
++        target_include_directories(RtAudio PUBLIC ${PULSEAUDIO_INCLUDE_DIRS})
++        link_directories(${PULSEAUDIO_LIBRARY_DIRS})
++        target_link_libraries(RtAudio PUBLIC ${PULSEAUDIO_LIBRARIES})
++      endif()
++    elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
++      target_compile_definitions(RtAudio PUBLIC "__WINDOWS_DS__")
++      target_link_libraries(RtAudio PUBLIC "dsound" "ole32")
++      target_compile_definitions(RtAudio PUBLIC "__WINDOWS_WASAPI__")
++      target_link_libraries(RtAudio PUBLIC "ksguid")
++      target_compile_definitions(RtAudio PUBLIC "__WINDOWS_ASIO__")
++      target_include_directories(RtAudio PRIVATE
++        "src/audio/external/rtaudio/include")
++      target_sources(RtAudio PRIVATE
++        "src/audio/external/rtaudio/include/asio.cpp"
++        "src/audio/external/rtaudio/include/asiodrivers.cpp"
++        "src/audio/external/rtaudio/include/asiolist.cpp"
++        "src/audio/external/rtaudio/include/iasiothiscallresolver.cpp")
++    elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
++      target_compile_definitions(RtAudio PUBLIC "__MACOSX_CORE__")
++      find_library(COREAUDIO_LIBRARY "CoreAudio")
++      target_link_libraries(RtAudio PUBLIC "${COREAUDIO_LIBRARY}")
++      find_library(COREFOUNDATION_LIBRARY "CoreFoundation")
++      target_link_libraries(RtAudio PUBLIC "${COREFOUNDATION_LIBRARY}")
+     endif()
+-  elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+-    target_compile_definitions(RtAudio PUBLIC "__WINDOWS_DS__")
+-    target_link_libraries(RtAudio PUBLIC "dsound" "ole32")
+-    target_compile_definitions(RtAudio PUBLIC "__WINDOWS_WASAPI__")
+-    target_link_libraries(RtAudio PUBLIC "ksguid")
+-    target_compile_definitions(RtAudio PUBLIC "__WINDOWS_ASIO__")
+-    target_include_directories(RtAudio PRIVATE
+-      "src/audio/external/rtaudio/include")
+-    target_sources(RtAudio PRIVATE
+-      "src/audio/external/rtaudio/include/asio.cpp"
+-      "src/audio/external/rtaudio/include/asiodrivers.cpp"
+-      "src/audio/external/rtaudio/include/asiolist.cpp"
+-      "src/audio/external/rtaudio/include/iasiothiscallresolver.cpp")
+-  elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+-    target_compile_definitions(RtAudio PUBLIC "__MACOSX_CORE__")
+-    find_library(COREAUDIO_LIBRARY "CoreAudio")
+-    target_link_libraries(RtAudio PUBLIC "${COREAUDIO_LIBRARY}")
+-    find_library(COREFOUNDATION_LIBRARY "CoreFoundation")
+-    target_link_libraries(RtAudio PUBLIC "${COREFOUNDATION_LIBRARY}")
++    target_link_libraries(OPL3BankEditor PRIVATE RtAudio)
+   endif()
++
+   target_sources(OPL3BankEditor PRIVATE "src/audio/ao_rtaudio.cpp")
+   target_compile_definitions(OPL3BankEditor PRIVATE "ENABLE_AUDIO_TESTING")
+-  target_link_libraries(OPL3BankEditor PRIVATE RtAudio)
+ endif()
+ 
+ add_executable(measurer_tool
+-- 
+2.29.3
+
diff --git a/pkgs/tools/audio/opl3bankeditor/0001-opn2bankeditor-Look-for-system-installed-Rt-libs.patch b/pkgs/tools/audio/opl3bankeditor/0001-opn2bankeditor-Look-for-system-installed-Rt-libs.patch
new file mode 100644
index 00000000000..f62c3236b33
--- /dev/null
+++ b/pkgs/tools/audio/opl3bankeditor/0001-opn2bankeditor-Look-for-system-installed-Rt-libs.patch
@@ -0,0 +1,200 @@
+From 69c993dacc7dc0cb9d105c3dfa764cd7be5c343e Mon Sep 17 00:00:00 2001
+From: OPNA2608 <christoph.neidahl@gmail.com>
+Date: Sun, 13 Jun 2021 14:21:17 +0200
+Subject: [PATCH] Look for system-installed Rt libs
+
+---
+ CMakeLists.txt | 159 +++++++++++++++++++++++++++++++------------------
+ 1 file changed, 102 insertions(+), 57 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f428dc4..18ba8c3 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -41,15 +41,6 @@ message("!! Optional feature summary:")
+ message("!!   RtMidi: ${USE_RTMIDI}")
+ message("!!   RtAudio: ${USE_RTAUDIO}")
+ 
+-if(USE_RTAUDIO)
+-  if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+-    pkg_check_modules(JACK "jack")
+-    message("!!   -- Jack driver: ${JACK_FOUND}")
+-    pkg_check_modules(PULSEAUDIO "libpulse-simple")
+-    message("!!   -- Pulseaudio driver: ${PULSEAUDIO_FOUND}")
+-  endif()
+-endif()
+-
+ if(ENABLE_PLOTS)
+   message("!!   Qwt: ${QWT_LIBRARY}")
+ endif()
+@@ -198,65 +189,119 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ endif()
+ 
+ if(USE_RTMIDI)
+-  add_library(RtMidi STATIC "src/midi/external/rtmidi/RtMidi.cpp")
+-  target_include_directories(RtMidi PUBLIC "src/midi/external/rtmidi")
+-  if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+-    target_compile_definitions(RtMidi PUBLIC "__LINUX_ALSA__")
+-    target_link_libraries(RtMidi PUBLIC "asound")
+-  elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+-    target_compile_definitions(RtMidi PUBLIC "__WINDOWS_MM__")
+-    target_link_libraries(RtMidi PUBLIC "winmm")
+-  elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+-    target_compile_definitions(RtMidi PUBLIC "__MACOSX_CORE__")
+-    find_library(COREMIDI_LIBRARY "CoreMIDI")
+-    target_link_libraries(RtMidi PUBLIC "${COREMIDI_LIBRARY}")
++  if(PKG_CONFIG_FOUND)
++    pkg_check_modules(RTMIDI rtmidi)
++    if(RTMIDI_FOUND)
++      message("Using system-installed RtMidi found by pkg-config.")
++      target_link_libraries(OPN2BankEditor PUBLIC ${RTMIDI_LDFLAGS})
++      target_include_directories(OPN2BankEditor PUBLIC ${RTMIDI_INCLUDE_DIRS})
++      target_compile_options(OPN2BankEditor PUBLIC ${RTMIDI_CFLAGS})
++    endif()
++  endif()
++
++  if(NOT RTMIDI_FOUND)
++    find_library(RTMIDI_LIBRARY "rtmidi")
++    find_path(RTMIDI_INCLUDE_DIRS "RtMidi.h")
++    message("RtMidi library: ${RTMIDI_LIBRARY}")
++    message("RtMidi header directory: ${RTMIDI_INCLUDE_DIRS}")
++    if(NOT RTMIDI_LIBRARY-NOTFOUND AND NOT RTMIDI_INCLUDE_DIRS STREQUAL RTMIDI_INCLUDE_DIRS-NOTFOUND)
++      message("Using system-installed RtMidi.")
++      set(RTMIDI_FOUND TRUE)
++      target_link_libraries(OPN2BankEditor PUBLIC ${RTMIDI_LIBRARY})
++      target_include_directories(OPN2BankEditor PUBLIC ${RTMIDI_INCLUDE_DIRS})
++    endif()
++  endif()
++
++  if(NOT RTMIDI_FOUND)
++    message("Using bundled RtMidi.")
++    add_library(RtMidi STATIC "src/midi/external/rtmidi/RtMidi.cpp")
++    target_include_directories(RtMidi PUBLIC "src/midi/external/rtmidi")
++    if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
++      target_compile_definitions(RtMidi PUBLIC "__LINUX_ALSA__")
++      target_link_libraries(RtMidi PUBLIC "asound")
++    elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
++      target_compile_definitions(RtMidi PUBLIC "__WINDOWS_MM__")
++      target_link_libraries(RtMidi PUBLIC "winmm")
++    elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
++      target_compile_definitions(RtMidi PUBLIC "__MACOSX_CORE__")
++      find_library(COREMIDI_LIBRARY "CoreMIDI")
++      target_link_libraries(RtMidi PUBLIC "${COREMIDI_LIBRARY}")
++    endif()
++    target_link_libraries(OPN2BankEditor PRIVATE RtMidi)
+   endif()
++
+   target_sources(OPN2BankEditor PRIVATE "src/midi/midi_rtmidi.cpp")
+   target_compile_definitions(OPN2BankEditor PRIVATE "ENABLE_MIDI")
+-  target_link_libraries(OPN2BankEditor PRIVATE RtMidi)
+ endif()
+ 
+ if(USE_RTAUDIO)
+-  add_library(RtAudio STATIC "src/audio/external/rtaudio/RtAudio.cpp")
+-  target_include_directories(RtAudio PUBLIC "src/audio/external/rtaudio")
+-  if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+-    target_compile_definitions(RtAudio PUBLIC "__LINUX_ALSA__")
+-    target_link_libraries(RtAudio PUBLIC "asound")
+-    if(JACK_FOUND)
+-      target_compile_definitions(RtAudio PUBLIC "__UNIX_JACK__")
+-      target_include_directories(RtAudio PUBLIC ${JACK_INCLUDE_DIRS})
+-      link_directories(${JACK_LIBRARY_DIRS})
+-      target_link_libraries(RtAudio PUBLIC ${JACK_LIBRARIES})
++  if(PKG_CONFIG_FOUND)
++    pkg_check_modules(RTAUDIO rtaudio)
++    if(RTAUDIO_FOUND)
++      message("Using system-installed RtAudio found by pkg-config.")
++      target_link_libraries(OPN2BankEditor PUBLIC ${RTAUDIO_LDFLAGS})
++      target_include_directories(OPN2BankEditor PUBLIC ${RTAUDIO_INCLUDE_DIRS})
++      target_compile_options(OPN2BankEditor PUBLIC ${RTAUDIO_CFLAGS})
+     endif()
+-    if(PULSEAUDIO_FOUND)
+-      target_compile_definitions(RtAudio PUBLIC "__LINUX_PULSE__")
+-      target_include_directories(RtAudio PUBLIC ${PULSEAUDIO_INCLUDE_DIRS})
+-      link_directories(${PULSEAUDIO_LIBRARY_DIRS})
+-      target_link_libraries(RtAudio PUBLIC ${PULSEAUDIO_LIBRARIES})
++  endif()
++
++  if(NOT RTAUDIO_FOUND)
++    find_library(RTAUDIO_LIBRARY "rtaudio")
++    find_path(RTAUDIO_INCLUDE_DIRS "RtAudio.h")
++    message("RtAudio library: ${RTAUDIO_LIBRARY}")
++    message("RtAudio header directory: ${RTAUDIO_INCLUDE_DIRS}")
++    if(NOT RTAUDIO_LIBRARY-NOTFOUND AND NOT RTAUDIO_INCLUDE_DIRS STREQUAL RTAUDIO_INCLUDE_DIRS-NOTFOUND)
++      message("Using system-installed RtAudio.")
++      set(RTAUDIO_FOUND TRUE)
++      target_link_libraries(OPN2BankEditor PUBLIC ${RTAUDIO_LIBRARY})
++      target_include_directories(OPN2BankEditor PUBLIC ${RTAUDIO_INCLUDE_DIRS})
+     endif()
+-  elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+-    target_compile_definitions(RtAudio PUBLIC "__WINDOWS_DS__")
+-    target_link_libraries(RtAudio PUBLIC "dsound" "ole32")
+-    target_compile_definitions(RtAudio PUBLIC "__WINDOWS_WASAPI__")
+-    target_link_libraries(RtAudio PUBLIC "ksguid")
+-    target_compile_definitions(RtAudio PUBLIC "__WINDOWS_ASIO__")
+-    target_include_directories(RtAudio PRIVATE
+-      "src/audio/external/rtaudio/include")
+-    target_sources(RtAudio PRIVATE
+-      "src/audio/external/rtaudio/include/asio.cpp"
+-      "src/audio/external/rtaudio/include/asiodrivers.cpp"
+-      "src/audio/external/rtaudio/include/asiolist.cpp"
+-      "src/audio/external/rtaudio/include/iasiothiscallresolver.cpp")
+-  elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+-    target_compile_definitions(RtAudio PUBLIC "__MACOSX_CORE__")
+-    find_library(COREAUDIO_LIBRARY "CoreAudio")
+-    target_link_libraries(RtAudio PUBLIC "${COREAUDIO_LIBRARY}")
+-    find_library(COREFOUNDATION_LIBRARY "CoreFoundation")
+-    target_link_libraries(RtAudio PUBLIC "${COREFOUNDATION_LIBRARY}")
+   endif()
++
++  if(NOT RTAUDIO_FOUND)
++    message("Using bundled RtAudio.")
++    add_library(RtAudio STATIC "src/audio/external/rtaudio/RtAudio.cpp")
++    target_include_directories(RtAudio PUBLIC "src/audio/external/rtaudio")
++    if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
++      target_compile_definitions(RtAudio PUBLIC "__LINUX_ALSA__")
++      target_link_libraries(RtAudio PUBLIC "asound")
++      if(JACK_FOUND)
++        target_compile_definitions(RtAudio PUBLIC "__UNIX_JACK__")
++        target_include_directories(RtAudio PUBLIC ${JACK_INCLUDE_DIRS})
++        link_directories(${JACK_LIBRARY_DIRS})
++        target_link_libraries(RtAudio PUBLIC ${JACK_LIBRARIES})
++      endif()
++      if(PULSEAUDIO_FOUND)
++        target_compile_definitions(RtAudio PUBLIC "__LINUX_PULSE__")
++        target_include_directories(RtAudio PUBLIC ${PULSEAUDIO_INCLUDE_DIRS})
++        link_directories(${PULSEAUDIO_LIBRARY_DIRS})
++        target_link_libraries(RtAudio PUBLIC ${PULSEAUDIO_LIBRARIES})
++      endif()
++    elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
++      target_compile_definitions(RtAudio PUBLIC "__WINDOWS_DS__")
++      target_link_libraries(RtAudio PUBLIC "dsound" "ole32")
++      target_compile_definitions(RtAudio PUBLIC "__WINDOWS_WASAPI__")
++      target_link_libraries(RtAudio PUBLIC "ksguid")
++      target_compile_definitions(RtAudio PUBLIC "__WINDOWS_ASIO__")
++      target_include_directories(RtAudio PRIVATE
++        "src/audio/external/rtaudio/include")
++      target_sources(RtAudio PRIVATE
++        "src/audio/external/rtaudio/include/asio.cpp"
++        "src/audio/external/rtaudio/include/asiodrivers.cpp"
++        "src/audio/external/rtaudio/include/asiolist.cpp"
++        "src/audio/external/rtaudio/include/iasiothiscallresolver.cpp")
++    elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
++      target_compile_definitions(RtAudio PUBLIC "__MACOSX_CORE__")
++      find_library(COREAUDIO_LIBRARY "CoreAudio")
++      target_link_libraries(RtAudio PUBLIC "${COREAUDIO_LIBRARY}")
++      find_library(COREFOUNDATION_LIBRARY "CoreFoundation")
++      target_link_libraries(RtAudio PUBLIC "${COREFOUNDATION_LIBRARY}")
++    endif()
++    target_link_libraries(OPN2BankEditor PRIVATE RtAudio)
++  endif()
++
+   target_sources(OPN2BankEditor PRIVATE "src/audio/ao_rtaudio.cpp")
+   target_compile_definitions(OPN2BankEditor PRIVATE "ENABLE_AUDIO_TESTING")
+-  target_link_libraries(OPN2BankEditor PRIVATE RtAudio)
+ endif()
+ 
+ add_executable(measurer_tool
+-- 
+2.29.3
+
diff --git a/pkgs/tools/audio/opl3bankeditor/common.nix b/pkgs/tools/audio/opl3bankeditor/common.nix
new file mode 100644
index 00000000000..9f6972ce954
--- /dev/null
+++ b/pkgs/tools/audio/opl3bankeditor/common.nix
@@ -0,0 +1,69 @@
+{ pname, chip, version, sha256, extraPatches ? [] }:
+
+{ mkDerivation
+, stdenv
+, lib
+, fetchFromGitHub
+, dos2unix
+, cmake
+, pkg-config
+, qttools
+, qtbase
+, qwt
+, rtaudio
+, rtmidi
+}:
+
+let
+  binname = "${chip} Bank Editor";
+  mainProgram = "${lib.strings.toLower chip}_bank_editor";
+in
+mkDerivation rec {
+  inherit pname version;
+
+  src = fetchFromGitHub {
+    owner = "Wohlstand";
+    repo = pname;
+    rev = "v${version}";
+    inherit sha256;
+  };
+
+  prePatch = ''
+    dos2unix CMakeLists.txt
+  '';
+
+  patches = extraPatches;
+
+  nativeBuildInputs = [
+    dos2unix
+    cmake
+    pkg-config
+    qttools
+  ];
+
+  buildInputs = [
+    qtbase
+    qwt
+    rtaudio
+    rtmidi
+  ];
+
+  postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
+    mkdir $out/{bin,Applications}
+    mv "${binname}.app" $out/Applications/
+
+    install_name_tool -change {,${qwt}/lib/}libqwt.6.dylib "$out/Applications/${binname}.app/Contents/MacOS/${binname}"
+    wrapQtApp "$out/Applications/${binname}.app/Contents/MacOS/${binname}"
+
+    ln -s "$out/Applications/${binname}.app/Contents/MacOS/${binname}" $out/bin/${mainProgram}
+  '';
+
+  meta = with lib; {
+    inherit mainProgram;
+    description = "A small cross-platform editor of the ${chip} FM banks of different formats";
+    homepage = src.meta.homepage;
+    license = licenses.gpl3Plus;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ OPNA2608 ];
+  };
+}
diff --git a/pkgs/tools/audio/opl3bankeditor/default.nix b/pkgs/tools/audio/opl3bankeditor/default.nix
index 13f8dde680d..85762bb69b9 100644
--- a/pkgs/tools/audio/opl3bankeditor/default.nix
+++ b/pkgs/tools/audio/opl3bankeditor/default.nix
@@ -1,27 +1,9 @@
-{ lib, mkDerivation, fetchFromGitHub, cmake, qttools, alsa-lib }:
-
-mkDerivation rec {
+import ./common.nix rec {
+  pname = "opl3bankeditor";
+  chip = "OPL3";
   version = "1.5.1";
-  pname = "OPL3BankEditor";
-
-  src = fetchFromGitHub {
-    owner = "Wohlstand";
-    repo = pname;
-    rev = "v${version}";
-    sha256 = "1g59qrkcm4xnyxx0s2x28brqbf2ix6vriyx12pcdvfhhcdi55hxh";
-    fetchSubmodules = true;
-  };
-
-  buildInputs = [
-    alsa-lib qttools
+  sha256 = "08krbxlxgmc7i2r2k6d6wgi0m6k8hh3j60xf21kz4kp023w613sa";
+  extraPatches = [
+    ./0001-opl3bankeditor-Look-for-system-installed-Rt-libs.patch
   ];
-  nativeBuildInputs = [ cmake ];
-
-  meta = with lib; {
-    description = "A small cross-platform editor of the OPL3 FM banks of different formats";
-    homepage = src.meta.homepage;
-    license = licenses.gpl3;
-    platforms = platforms.linux;
-    maintainers = with maintainers; [ ];
-  };
 }
diff --git a/pkgs/tools/audio/opl3bankeditor/opn2bankeditor.nix b/pkgs/tools/audio/opl3bankeditor/opn2bankeditor.nix
index 1d10452470e..d9c4bbe1511 100644
--- a/pkgs/tools/audio/opl3bankeditor/opn2bankeditor.nix
+++ b/pkgs/tools/audio/opl3bankeditor/opn2bankeditor.nix
@@ -1,14 +1,9 @@
-{ opl3bankeditor, fetchFromGitHub }:
-
-opl3bankeditor.overrideAttrs (oldAttrs: rec {
+import ./common.nix rec {
+  pname = "opn2bankeditor";
+  chip = "OPN2";
   version = "1.3";
-  pname = "OPN2BankEditor";
-
-  src = fetchFromGitHub {
-    owner = "Wohlstand";
-    repo = pname;
-    rev = "v${version}";
-    sha256 = "0xsvv0gxqh1lx22f1jm384f7mq1jp57fmpsx1jjaxz435w5hf8s0";
-    fetchSubmodules = true;
-  };
-})
+  sha256 = "0niam6a6y57msbl0xj23g6l7gisv4a670q0k1zqfm34804532a32";
+  extraPatches = [
+    ./0001-opn2bankeditor-Look-for-system-installed-Rt-libs.patch
+  ];
+}
diff --git a/pkgs/tools/graphics/eplot/default.nix b/pkgs/tools/graphics/eplot/default.nix
index b4dd9cd36d8..2e69bc8a263 100644
--- a/pkgs/tools/graphics/eplot/default.nix
+++ b/pkgs/tools/graphics/eplot/default.nix
@@ -1,7 +1,8 @@
 { lib, stdenv, fetchurl, gnuplot, ruby }:
 
 stdenv.mkDerivation {
-  name = "eplot-2.07";
+  pname = "eplot";
+  version = "2.09";
 
   # Upstream has been contacted (2015-03) regarding providing versioned
   # download URLs. Initial response was positive, but no action yet.
@@ -20,12 +21,16 @@ stdenv.mkDerivation {
   dontUnpack = true;
 
   installPhase = ''
+    runHook preInstall
+
     mkdir -p "$out/bin"
     cp "$src" "$out/bin/eplot"
     cp "$ecSrc" "$out/bin/ec"
     chmod +x "$out/bin/"*
 
     sed -i -e "s|gnuplot -persist|${gnuplot}/bin/gnuplot -persist|" "$out/bin/eplot"
+
+    runHook postInstall
   '';
 
   meta = with lib; {
@@ -39,9 +44,9 @@ stdenv.mkDerivation {
       This package also includes the complementary 'ec' tool (say "extract
       column").
     '';
-    homepage = "http://liris.cnrs.fr/christian.wolf/software/eplot/";
+    homepage = "https://perso.liris.cnrs.fr/christian.wolf/software/eplot/";
     license = licenses.gpl2Plus;
     platforms = platforms.all;
-    maintainers = [ maintainers.bjornfor ];
+    maintainers = with maintainers; [ bjornfor shamilton ];
   };
 }
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 400c7847fce..49c9c3fa12f 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -765,15 +765,17 @@ in
 
   adafruit-ampy = callPackage ../tools/misc/adafruit-ampy { };
 
-  adlplug = callPackage ../applications/audio/adlplug { };
+  adlplug = callPackage ../applications/audio/adlplug {
+    inherit (darwin) libobjc;
+    inherit (darwin.apple_sdk.frameworks) Cocoa CoreServices WebKit DiscRecording;
+    jack = libjack2;
+  };
+  opnplug = adlplug.override {
+    type = "OPN";
+  };
 
   arc_unpacker = callPackage ../tools/archivers/arc_unpacker { };
 
-  opnplug = callPackage ../applications/audio/adlplug {
-    adlplugChip = "-DADLplug_CHIP=OPN2";
-    pname = "OPNplug";
-  };
-
   adminer = callPackage ../servers/adminer { };
 
   advancecomp = callPackage ../tools/compression/advancecomp {};
@@ -7041,7 +7043,9 @@ in
 
   munge = callPackage ../tools/security/munge { };
 
-  munt = libsForQt5.callPackage ../applications/audio/munt { };
+  munt = libsForQt5.callPackage ../applications/audio/munt {
+    jack = libjack2;
+  };
 
   mutagen = callPackage ../tools/misc/mutagen { };
 
@@ -7588,8 +7592,7 @@ in
   olsrd = callPackage ../tools/networking/olsrd { };
 
   opl3bankeditor = libsForQt5.callPackage ../tools/audio/opl3bankeditor { };
-
-  opn2bankeditor = callPackage ../tools/audio/opl3bankeditor/opn2bankeditor.nix { };
+  opn2bankeditor = libsForQt5.callPackage ../tools/audio/opl3bankeditor/opn2bankeditor.nix { };
 
   orangefs = callPackage ../tools/filesystems/orangefs {
     autoreconfHook = buildPackages.autoreconfHook269;
@@ -15914,6 +15917,8 @@ in
   libbass = (callPackage ../development/libraries/audio/libbass { }).bass;
   libbass_fx = (callPackage ../development/libraries/audio/libbass { }).bass_fx;
 
+  libbencodetools = callPackage ../development/libraries/libbencodetools { };
+
   libbluedevil = callPackage ../development/libraries/libbluedevil { };
 
   libbdplus = callPackage ../development/libraries/libbdplus { };
diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix
index c6172887833..5a6f426b836 100644
--- a/pkgs/top-level/ocaml-packages.nix
+++ b/pkgs/top-level/ocaml-packages.nix
@@ -1034,6 +1034,8 @@ let
 
     tls = callPackage ../development/ocaml-modules/tls { };
 
+    tls-async = callPackage ../development/ocaml-modules/tls/async.nix { };
+
     tls-mirage = callPackage ../development/ocaml-modules/tls/mirage.nix { };
 
     torch = callPackage ../development/ocaml-modules/torch {
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 41570dce009..9d5f97f6def 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -7184,6 +7184,8 @@ in {
 
   pyyaml = callPackage ../development/python-modules/pyyaml { };
 
+  pyyaml-env-tag = callPackage ../development/python-modules/pyyaml-env-tag { };
+
   pyzerproc = callPackage ../development/python-modules/pyzerproc { };
 
   pyzmq = callPackage ../development/python-modules/pyzmq { };