about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/archivers
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/archivers')
-rw-r--r--nixpkgs/pkgs/tools/archivers/7zz/default.nix127
-rw-r--r--nixpkgs/pkgs/tools/archivers/7zz/fix-build-on-darwin.patch24
-rw-r--r--nixpkgs/pkgs/tools/archivers/7zz/fix-cross-mingw-build.patch659
-rwxr-xr-xnixpkgs/pkgs/tools/archivers/7zz/update.sh51
-rw-r--r--nixpkgs/pkgs/tools/archivers/afio/0001-makefile-fix-installation.patch45
-rw-r--r--nixpkgs/pkgs/tools/archivers/afio/default.nix33
-rw-r--r--nixpkgs/pkgs/tools/archivers/arc_unpacker/default.nix89
-rw-r--r--nixpkgs/pkgs/tools/archivers/arj/default.nix155
-rw-r--r--nixpkgs/pkgs/tools/archivers/atool/default.nix21
-rw-r--r--nixpkgs/pkgs/tools/archivers/bomutils/default.nix33
-rw-r--r--nixpkgs/pkgs/tools/archivers/cabextract/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/archivers/cpio/default.nix42
-rw-r--r--nixpkgs/pkgs/tools/archivers/cromfs/default.nix32
-rw-r--r--nixpkgs/pkgs/tools/archivers/ctrtool/default.nix31
-rw-r--r--nixpkgs/pkgs/tools/archivers/dumpnar/default.nix26
-rw-r--r--nixpkgs/pkgs/tools/archivers/fsarchiver/default.nix44
-rw-r--r--nixpkgs/pkgs/tools/archivers/gbl/default.nix56
-rw-r--r--nixpkgs/pkgs/tools/archivers/gnutar/default.nix73
-rw-r--r--nixpkgs/pkgs/tools/archivers/innoextract/default.nix36
-rw-r--r--nixpkgs/pkgs/tools/archivers/lha/default.nix27
-rw-r--r--nixpkgs/pkgs/tools/archivers/maxcso/default.nix26
-rw-r--r--nixpkgs/pkgs/tools/archivers/ndstool/default.nix24
-rw-r--r--nixpkgs/pkgs/tools/archivers/p7zip/default.nix76
-rw-r--r--nixpkgs/pkgs/tools/archivers/p7zip/setup-hook.sh5
-rwxr-xr-xnixpkgs/pkgs/tools/archivers/p7zip/update.sh47
-rw-r--r--nixpkgs/pkgs/tools/archivers/pax/default.nix35
-rwxr-xr-xnixpkgs/pkgs/tools/archivers/payload-dumper-go/default.nix30
-rw-r--r--nixpkgs/pkgs/tools/archivers/payload_dumper/default.nix43
-rw-r--r--nixpkgs/pkgs/tools/archivers/pxattr/default.nix26
-rw-r--r--nixpkgs/pkgs/tools/archivers/quickbms/0002-disable-openssl.patch10
-rw-r--r--nixpkgs/pkgs/tools/archivers/quickbms/default.nix43
-rw-r--r--nixpkgs/pkgs/tools/archivers/rar/default.nix68
-rw-r--r--nixpkgs/pkgs/tools/archivers/rpm2targz/default.nix50
-rw-r--r--nixpkgs/pkgs/tools/archivers/rpmextract/default.nix23
-rw-r--r--nixpkgs/pkgs/tools/archivers/rpmextract/rpmextract.sh10
-rw-r--r--nixpkgs/pkgs/tools/archivers/runzip/default.nix23
-rw-r--r--nixpkgs/pkgs/tools/archivers/s-tar/default.nix35
-rw-r--r--nixpkgs/pkgs/tools/archivers/sharutils/default.nix86
-rw-r--r--nixpkgs/pkgs/tools/archivers/snzip/default.nix31
-rw-r--r--nixpkgs/pkgs/tools/archivers/tarlz/default.nix28
-rw-r--r--nixpkgs/pkgs/tools/archivers/torrent7z/default.nix53
-rw-r--r--nixpkgs/pkgs/tools/archivers/unar/default.nix98
-rw-r--r--nixpkgs/pkgs/tools/archivers/undmg/default.nix29
-rw-r--r--nixpkgs/pkgs/tools/archivers/undmg/setup-hook.sh5
-rw-r--r--nixpkgs/pkgs/tools/archivers/unp/default.nix44
-rw-r--r--nixpkgs/pkgs/tools/archivers/unrar-wrapper/default.nix36
-rw-r--r--nixpkgs/pkgs/tools/archivers/unrar-wrapper/setup-hook.sh5
-rw-r--r--nixpkgs/pkgs/tools/archivers/unrar/default.nix54
-rw-r--r--nixpkgs/pkgs/tools/archivers/unrar/setup-hook.sh5
-rw-r--r--nixpkgs/pkgs/tools/archivers/unshield/default.nix23
-rw-r--r--nixpkgs/pkgs/tools/archivers/unzip/CVE-2014-8139.diff47
-rw-r--r--nixpkgs/pkgs/tools/archivers/unzip/CVE-2014-8140.diff26
-rw-r--r--nixpkgs/pkgs/tools/archivers/unzip/CVE-2014-8141.diff136
-rw-r--r--nixpkgs/pkgs/tools/archivers/unzip/CVE-2014-9636.diff42
-rw-r--r--nixpkgs/pkgs/tools/archivers/unzip/CVE-2014-9913.patch29
-rw-r--r--nixpkgs/pkgs/tools/archivers/unzip/CVE-2015-7696.diff66
-rw-r--r--nixpkgs/pkgs/tools/archivers/unzip/CVE-2015-7697.diff36
-rw-r--r--nixpkgs/pkgs/tools/archivers/unzip/CVE-2016-9844.patch28
-rw-r--r--nixpkgs/pkgs/tools/archivers/unzip/CVE-2018-18384.patch35
-rw-r--r--nixpkgs/pkgs/tools/archivers/unzip/default.nix106
-rw-r--r--nixpkgs/pkgs/tools/archivers/unzip/dont-hardcode-cc.patch14
-rw-r--r--nixpkgs/pkgs/tools/archivers/unzip/implicit-declarations-fix.patch21
-rw-r--r--nixpkgs/pkgs/tools/archivers/unzip/setup-hook.sh11
-rw-r--r--nixpkgs/pkgs/tools/archivers/unzoo/default.nix44
-rw-r--r--nixpkgs/pkgs/tools/archivers/wimlib/default.nix48
-rw-r--r--nixpkgs/pkgs/tools/archivers/xarchive/default.nix23
-rw-r--r--nixpkgs/pkgs/tools/archivers/xarchiver/default.nix31
-rw-r--r--nixpkgs/pkgs/tools/archivers/zarchive/default.nix23
-rw-r--r--nixpkgs/pkgs/tools/archivers/zip/default.nix41
-rw-r--r--nixpkgs/pkgs/tools/archivers/zip/natspec-gentoo.patch.bz2bin0 -> 1914 bytes
-rw-r--r--nixpkgs/pkgs/tools/archivers/zpaq/default.nix32
-rw-r--r--nixpkgs/pkgs/tools/archivers/zpaq/zpaqd.nix40
72 files changed, 3579 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/archivers/7zz/default.nix b/nixpkgs/pkgs/tools/archivers/7zz/default.nix
new file mode 100644
index 000000000000..06fb4aae1a0e
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/7zz/default.nix
@@ -0,0 +1,127 @@
+{ stdenv
+, lib
+, fetchurl
+
+  # Only used for Linux's x86/x86_64
+, uasm
+, useUasm ? (stdenv.isLinux && stdenv.hostPlatform.isx86)
+
+  # RAR code is under non-free unRAR license
+  # see the meta.license section below for more details
+, enableUnfree ? false
+
+  # For tests
+, _7zz
+, testers
+}:
+
+let
+  makefile = {
+    aarch64-darwin = "../../cmpl_mac_arm64.mak";
+    x86_64-darwin = "../../cmpl_mac_x64.mak";
+    aarch64-linux = "../../cmpl_gcc_arm64.mak";
+    i686-linux = "../../cmpl_gcc_x86.mak";
+    x86_64-linux = "../../cmpl_gcc_x64.mak";
+  }.${stdenv.hostPlatform.system} or "../../cmpl_gcc.mak"; # generic build
+in
+stdenv.mkDerivation rec {
+  pname = "7zz";
+  version = "22.01";
+
+  src = fetchurl {
+    url = "https://7-zip.org/a/7z${lib.replaceStrings [ "." ] [ "" ] version}-src.tar.xz";
+    hash = {
+      free = "sha256-mp3cFXOEiVptkUdD1+X8XxwoJhBGs+Ns5qk3HBByfLg=";
+      unfree = "sha256-OTCYcwxwBCOSr4CJF+dllF3CQ33ueq48/MSWbrkg+8U=";
+    }.${if enableUnfree then "unfree" else "free"};
+    downloadToTemp = (!enableUnfree);
+    # remove the unRAR related code from the src drv
+    # > the license requires that you agree to these use restrictions,
+    # > or you must remove the software (source and binary) from your hard disks
+    # https://fedoraproject.org/wiki/Licensing:Unrar
+    postFetch = lib.optionalString (!enableUnfree) ''
+      mkdir tmp
+      tar xf $downloadedFile -C ./tmp
+      rm -r ./tmp/CPP/7zip/Compress/Rar*
+      tar cfJ $out -C ./tmp . \
+        --sort=name \
+        --mtime="@$SOURCE_DATE_EPOCH" \
+        --owner=0 --group=0 --numeric-owner \
+        --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime
+    '';
+  };
+
+  sourceRoot = ".";
+
+  patches = [
+    ./fix-build-on-darwin.patch
+    ./fix-cross-mingw-build.patch
+  ];
+  patchFlags = [ "-p0" ];
+
+  postPatch = lib.optionalString stdenv.hostPlatform.isMinGW ''
+    substituteInPlace CPP/7zip/7zip_gcc.mak C/7zip_gcc_c.mak \
+      --replace windres.exe ${stdenv.cc.targetPrefix}windres
+  '';
+
+  env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.isDarwin [
+    "-Wno-deprecated-copy-dtor"
+  ] ++ lib.optionals stdenv.hostPlatform.isMinGW [
+    "-Wno-conversion"
+    "-Wno-unused-macros"
+  ]);
+
+  inherit makefile;
+
+  makeFlags =
+    [
+      "CC=${stdenv.cc.targetPrefix}cc"
+      "CXX=${stdenv.cc.targetPrefix}c++"
+    ]
+    ++ lib.optionals useUasm [ "MY_ASM=uasm" ]
+    # We need at minimum 10.13 here because of utimensat, however since
+    # we need a bump anyway, let's set the same minimum version as the one in
+    # aarch64-darwin so we don't need additional changes for it
+    ++ lib.optionals stdenv.isDarwin [ "MACOSX_DEPLOYMENT_TARGET=10.16" ]
+    # it's the compression code with the restriction, see DOC/License.txt
+    ++ lib.optionals (!enableUnfree) [ "DISABLE_RAR_COMPRESS=true" ]
+    ++ lib.optionals (stdenv.hostPlatform.isMinGW) [ "IS_MINGW=1" "MSYSTEM=1" ];
+
+  nativeBuildInputs = lib.optionals useUasm [ uasm ];
+
+  enableParallelBuilding = true;
+
+  preBuild = "cd CPP/7zip/Bundles/Alone2";
+
+  installPhase = ''
+    runHook preInstall
+
+    install -Dm555 -t $out/bin b/*/7zz${stdenv.hostPlatform.extensions.executable}
+    install -Dm444 -t $out/share/doc/${pname} ../../../../DOC/*.txt
+
+    runHook postInstall
+  '';
+
+  passthru = {
+    updateScript = ./update.sh;
+    tests.version = testers.testVersion {
+      package = _7zz;
+      command = "7zz --help";
+    };
+  };
+
+  meta = with lib; {
+    description = "Command line archiver utility";
+    homepage = "https://7-zip.org";
+    license = with licenses;
+      # 7zip code is largely lgpl2Plus
+      # CPP/7zip/Compress/LzfseDecoder.cpp is bsd3
+      [ lgpl2Plus /* and */ bsd3 ] ++
+      # and CPP/7zip/Compress/Rar* are unfree with the unRAR license restriction
+      # the unRAR compression code is disabled by default
+      lib.optionals enableUnfree [ unfree ];
+    maintainers = with maintainers; [ anna328p peterhoeg jk ];
+    platforms = platforms.unix ++ platforms.windows;
+    mainProgram = "7zz";
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/7zz/fix-build-on-darwin.patch b/nixpkgs/pkgs/tools/archivers/7zz/fix-build-on-darwin.patch
new file mode 100644
index 000000000000..9d8ee7f9bc60
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/7zz/fix-build-on-darwin.patch
@@ -0,0 +1,24 @@
+diff -Naur CPP/7zip/Common/FileStreams.cpp CPP/7zip/Common/FileStreams.cpp
+--- CPP/7zip/Common/FileStreams.cpp
++++ CPP/7zip/Common/FileStreams.cpp
+@@ -12,7 +12,7 @@
+ #include <pwd.h>

+ 

+ // for major()/minor():

+-#if defined(__FreeBSD__) || defined(BSD)

++#if defined(__FreeBSD__) || defined(BSD) || defined(__APPLE__)

+ #include <sys/types.h>

+ #else

+ #include <sys/sysmacros.h>

+diff -Naur CPP/7zip/UI/Common/UpdateCallback.cpp CPP/7zip/UI/Common/UpdateCallback.cpp
+--- CPP/7zip/UI/Common/UpdateCallback.cpp
++++ CPP/7zip/UI/Common/UpdateCallback.cpp
+@@ -9,7 +9,7 @@
+ // #include <pwd.h>

+ 

+ // for major()/minor():

+-#if defined(__FreeBSD__) || defined(BSD)

++#if defined(__FreeBSD__) || defined(BSD) || defined(__APPLE__)

+ #include <sys/types.h>

+ #else

+ #include <sys/sysmacros.h>

diff --git a/nixpkgs/pkgs/tools/archivers/7zz/fix-cross-mingw-build.patch b/nixpkgs/pkgs/tools/archivers/7zz/fix-cross-mingw-build.patch
new file mode 100644
index 000000000000..59608b52b793
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/7zz/fix-cross-mingw-build.patch
@@ -0,0 +1,659 @@
+diff --git C/7zVersion.rc C/7zVersion.rc
+index 6ed26de7445..675e9bb0321 100755
+--- C/7zVersion.rc
++++ C/7zVersion.rc
+@@ -5,7 +5,7 @@
+ #define MY_VFT_APP  0x00000001L

+ #define MY_VFT_DLL  0x00000002L

+ 

+-// #include <WinVer.h>

++// #include <winver.h>

+ 

+ #ifndef MY_VERSION

+ #include "7zVersion.h"

+diff --git C/7zip_gcc_c.mak C/7zip_gcc_c.mak
+index d41810478db..43cdd51271e 100755
+--- C/7zip_gcc_c.mak
++++ C/7zip_gcc_c.mak
+@@ -93,7 +93,7 @@ DEL_OBJ_EXE = -$(RM) $(O)\*.o $(O)\$(PROG).exe $(O)\$(PROG).dll
+ endif

+ 

+ 

+-LIB2 = -lOle32 -loleaut32 -luuid -ladvapi32 -lUser32

++LIB2 = -lole32 -loleaut32 -luuid -ladvapi32 -luser32

+ 

+ CXXFLAGS_EXTRA = -DUNICODE -D_UNICODE

+ # -Wno-delete-non-virtual-dtor

+diff --git C/Alloc.c C/Alloc.c
+index 142a1ea2219..0d0107c56f4 100755
+--- C/Alloc.c
++++ C/Alloc.c
+@@ -6,7 +6,7 @@
+ #include <stdio.h>

+ 

+ #ifdef _WIN32

+-#include <Windows.h>

++#include <windows.h>

+ #endif

+ #include <stdlib.h>

+ 

+diff --git C/CpuArch.c C/CpuArch.c
+index a0e93e8b08e..36e0be0b1c8 100755
+--- C/CpuArch.c
++++ C/CpuArch.c
+@@ -217,7 +217,7 @@ BoolInt CPU_Is_InOrder()
+ }

+ 

+ #if !defined(MY_CPU_AMD64) && defined(_WIN32)

+-#include <Windows.h>

++#include <windows.h>

+ static BoolInt CPU_Sys_Is_SSE_Supported()

+ {

+   OSVERSIONINFO vi;

+@@ -275,7 +275,7 @@ BoolInt CPU_IsSupported_SHA()
+ // #include <stdio.h>

+ 

+ #ifdef _WIN32

+-#include <Windows.h>

++#include <windows.h>

+ #endif

+ 

+ BoolInt CPU_IsSupported_AVX2()

+@@ -351,7 +351,7 @@ BoolInt CPU_IsSupported_PageGB()
+ 

+ #ifdef _WIN32

+ 

+-#include <Windows.h>

++#include <windows.h>

+ 

+ BoolInt CPU_IsSupported_CRC32()  { return IsProcessorFeaturePresent(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE) ? 1 : 0; }

+ BoolInt CPU_IsSupported_CRYPTO() { return IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE) ? 1 : 0; }

+diff --git C/DllSecur.c C/DllSecur.c
+index a37c1b3e2c5..16755bba930 100755
+--- C/DllSecur.c
++++ C/DllSecur.c
+@@ -5,7 +5,7 @@
+ 

+ #ifdef _WIN32

+ 

+-#include <Windows.h>

++#include <windows.h>

+ 

+ #include "DllSecur.h"

+ 

+diff --git C/Threads.h C/Threads.h
+index e9493afff62..71972558d48 100755
+--- C/Threads.h
++++ C/Threads.h
+@@ -5,7 +5,7 @@
+ #define __7Z_THREADS_H

+ 

+ #ifdef _WIN32

+-#include <Windows.h>

++#include <windows.h>

+ #else

+ 

+ #if defined(__linux__)

+diff --git C/Util/7zipInstall/7zipInstall.c C/Util/7zipInstall/7zipInstall.c
+index 2c498bb4392..d791bc4181c 100755
+--- C/Util/7zipInstall/7zipInstall.c
++++ C/Util/7zipInstall/7zipInstall.c
+@@ -10,7 +10,7 @@
+ #endif

+ 

+ #include <windows.h>

+-#include <ShlObj.h>

++#include <shlobj.h>

+ 

+ #include "../../7z.h"

+ #include "../../7zAlloc.h"

+diff --git C/Util/7zipInstall/resource.rc C/Util/7zipInstall/resource.rc
+index 4d6a91feda1..c19f601f69f 100755
+--- C/Util/7zipInstall/resource.rc
++++ C/Util/7zipInstall/resource.rc
+@@ -1,6 +1,6 @@
+ #include <winnt.h>

+ #include <WinUser.h>

+-#include <CommCtrl.h>

++#include <commctrl.h>

+ 

+ #define USE_COPYRIGHT_CR

+ #include "../../7zVersion.rc"

+diff --git C/Util/7zipUninstall/7zipUninstall.c C/Util/7zipUninstall/7zipUninstall.c
+index 89cd764dbe9..32ece1c6c14 100755
+--- C/Util/7zipUninstall/7zipUninstall.c
++++ C/Util/7zipUninstall/7zipUninstall.c
+@@ -11,7 +11,7 @@
+ // #define SZ_ERROR_ABORT 100

+ 

+ #include <windows.h>

+-#include <ShlObj.h>

++#include <shlobj.h>

+ 

+ #include "../../7zVersion.h"

+ 

+diff --git C/Util/7zipUninstall/resource.rc C/Util/7zipUninstall/resource.rc
+index 506e0665cdd..ae1dfedc83b 100755
+--- C/Util/7zipUninstall/resource.rc
++++ C/Util/7zipUninstall/resource.rc
+@@ -1,6 +1,6 @@
+ #include <winnt.h>

+ #include <WinUser.h>

+-#include <CommCtrl.h>

++#include <commctrl.h>

+ 

+ #define USE_COPYRIGHT_CR

+ #include "../../7zVersion.rc"

+diff --git CPP/7zip/7zip_gcc.mak CPP/7zip/7zip_gcc.mak
+index 2a24e06aa1f..fb32b933201 100755
+--- CPP/7zip/7zip_gcc.mak
++++ CPP/7zip/7zip_gcc.mak
+@@ -113,8 +113,8 @@ MY_MKDIR=mkdir
+ DEL_OBJ_EXE = -$(RM) $(O)\*.o $(O)\$(PROG).exe $(O)\$(PROG).dll

+ endif

+ 

+-LIB2_GUI = -lOle32 -lGdi32 -lComctl32 -lComdlg32 $(LIB_HTMLHELP)

+-LIB2 = -loleaut32 -luuid -ladvapi32 -lUser32 $(LIB2_GUI)

++LIB2_GUI = -lole32 -lgdi32 -lcomctl32 -lcomdlg32 $(LIB_HTMLHELP)

++LIB2 = -loleaut32 -luuid -ladvapi32 -luser32 $(LIB2_GUI)

+ 

+ CXXFLAGS_EXTRA = -DUNICODE -D_UNICODE

+ # -Wno-delete-non-virtual-dtor

+diff --git CPP/7zip/Bundles/Fm/StdAfx.h CPP/7zip/Bundles/Fm/StdAfx.h
+index c15e07939da..d1e094cc339 100755
+--- CPP/7zip/Bundles/Fm/StdAfx.h
++++ CPP/7zip/Bundles/Fm/StdAfx.h
+@@ -9,8 +9,8 @@
+ 

+ #include "../../../Common/Common.h"

+ 

+-#include <CommCtrl.h>

+-#include <ShlObj.h>

+-#include <Shlwapi.h>

++#include <commctrl.h>

++#include <shlobj.h>

++#include <shlwapi.h>

+ 

+ #endif

+diff --git CPP/7zip/Bundles/SFXWin/SfxWin.cpp CPP/7zip/Bundles/SFXWin/SfxWin.cpp
+index cf3bad389a0..260484c11e4 100755
+--- CPP/7zip/Bundles/SFXWin/SfxWin.cpp
++++ CPP/7zip/Bundles/SFXWin/SfxWin.cpp
+@@ -4,7 +4,7 @@
+ 

+ #include "../../../Common/MyWindows.h"

+ 

+-#include <Shlwapi.h>

++#include <shlwapi.h>

+ 

+ #include "../../../Common/MyInitGuid.h"

+ 

+diff --git CPP/7zip/Bundles/SFXWin/StdAfx.h CPP/7zip/Bundles/SFXWin/StdAfx.h
+index f263ecb77c5..e96640e995c 100755
+--- CPP/7zip/Bundles/SFXWin/StdAfx.h
++++ CPP/7zip/Bundles/SFXWin/StdAfx.h
+@@ -6,7 +6,7 @@
+ #include "../../../Common/Common.h"

+ 

+ #include <commctrl.h>

+-#include <ShlObj.h>

++#include <shlobj.h>

+ 

+ // #define printf(x) NO_PRINTF_(x)

+ // #define sprintf(x) NO_SPRINTF_(x)

+diff --git CPP/7zip/Crypto/RandGen.cpp CPP/7zip/Crypto/RandGen.cpp
+index c123109a15b..c3709ccff6b 100755
+--- CPP/7zip/Crypto/RandGen.cpp
++++ CPP/7zip/Crypto/RandGen.cpp
+@@ -19,7 +19,7 @@
+ 

+ #ifdef USE_STATIC_RtlGenRandom

+ 

+-// #include <NTSecAPI.h>

++// #include <ntsecapi.h>

+ 

+ EXTERN_C_BEGIN

+ #ifndef RtlGenRandom

+diff --git CPP/7zip/GuiCommon.rc CPP/7zip/GuiCommon.rc
+index 565ee702ef9..13043ef4c53 100755
+--- CPP/7zip/GuiCommon.rc
++++ CPP/7zip/GuiCommon.rc
+@@ -4,7 +4,7 @@
+ // #include <WinUser.h>

+ 

+ // for Windows CE:

+-#include <CommCtrl.h>

++#include <commctrl.h>

+ 

+ 

+ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

+diff --git CPP/7zip/MyVersionInfo.rc CPP/7zip/MyVersionInfo.rc
+index eddf8935c84..90e65376be8 100755
+--- CPP/7zip/MyVersionInfo.rc
++++ CPP/7zip/MyVersionInfo.rc
+@@ -1,2 +1,2 @@
+ #include "MyVersion.h"

+-#include "..\..\C\7zVersion.rc"

++#include "../../C/7zVersion.rc"

+diff --git CPP/7zip/UI/Common/Update.cpp CPP/7zip/UI/Common/Update.cpp
+index 5490ff445a0..003ee6634ea 100755
+--- CPP/7zip/UI/Common/Update.cpp
++++ CPP/7zip/UI/Common/Update.cpp
+@@ -1163,7 +1163,7 @@ static HRESULT EnumerateInArchiveItems(
+ 

+ #if defined(_WIN32) && !defined(UNDER_CE)

+ 

+-#include <MAPI.h>

++#include <mapi.h>

+ 

+ #endif

+ 

+diff --git CPP/7zip/UI/Console/Main.cpp CPP/7zip/UI/Console/Main.cpp
+index 363572cd3dd..765f55293a7 100755
+--- CPP/7zip/UI/Console/Main.cpp
++++ CPP/7zip/UI/Console/Main.cpp
+@@ -5,7 +5,7 @@
+ #include "../../../Common/MyWindows.h"

+ 

+ #ifdef _WIN32

+-#include <Psapi.h>

++#include <psapi.h>

+ #else

+ #include <unistd.h>

+ #include <sys/ioctl.h>

+diff --git CPP/7zip/UI/Explorer/ContextMenu.h CPP/7zip/UI/Explorer/ContextMenu.h
+index e60ffccf11b..aea34e7de07 100755
+--- CPP/7zip/UI/Explorer/ContextMenu.h
++++ CPP/7zip/UI/Explorer/ContextMenu.h
+@@ -5,7 +5,7 @@
+ 

+ #include "../../../Common/MyWindows.h"

+ 

+-#include <ShlObj.h>

++#include <shlobj.h>

+ 

+ #include "MyExplorerCommand.h"

+ 

+diff --git CPP/7zip/UI/Explorer/DllExportsExplorer.cpp CPP/7zip/UI/Explorer/DllExportsExplorer.cpp
+index 84c92e2e2d3..df126d8d232 100755
+--- CPP/7zip/UI/Explorer/DllExportsExplorer.cpp
++++ CPP/7zip/UI/Explorer/DllExportsExplorer.cpp
+@@ -11,7 +11,7 @@
+ #include "../../../Common/MyWindows.h"

+ // #include "../../../Common/IntToString.h"

+ 

+-#include <OleCtl.h>

++#include <olectl.h>

+ 

+ #include "../../../Common/MyInitGuid.h"

+ 

+diff --git CPP/7zip/UI/Explorer/MyExplorerCommand.h CPP/7zip/UI/Explorer/MyExplorerCommand.h
+index b1997f0da6e..d1d038df11b 100755
+--- CPP/7zip/UI/Explorer/MyExplorerCommand.h
++++ CPP/7zip/UI/Explorer/MyExplorerCommand.h
+@@ -17,7 +17,7 @@
+     ShObjIdl.h      : old Windows SDK

+     ShObjIdl_core.h : new Windows 10 SDK */

+ 

+-#include <ShObjIdl.h>

++#include <shobjidl.h>

+ 

+ #ifndef __IShellItem_INTERFACE_DEFINED__

+ #define __IShellItem_INTERFACE_DEFINED__

+diff --git CPP/7zip/UI/Explorer/StdAfx.h CPP/7zip/UI/Explorer/StdAfx.h
+index 35e8b337d68..16883ceda1b 100755
+--- CPP/7zip/UI/Explorer/StdAfx.h
++++ CPP/7zip/UI/Explorer/StdAfx.h
+@@ -9,6 +9,6 @@
+ 

+ #include "../../../Common/Common.h"

+ 

+-#include <ShlObj.h>

++#include <shlobj.h>

+ 

+ #endif

+diff --git CPP/7zip/UI/FileManager/BrowseDialog.cpp CPP/7zip/UI/FileManager/BrowseDialog.cpp
+index e43172385b6..286faeeb660 100755
+--- CPP/7zip/UI/FileManager/BrowseDialog.cpp
++++ CPP/7zip/UI/FileManager/BrowseDialog.cpp
+@@ -4,7 +4,7 @@
+ 

+ #include "../../../Common/MyWindows.h"

+ 

+-#include <CommCtrl.h>

++#include <commctrl.h>

+ 

+ #ifndef UNDER_CE

+ #include "../../../Windows/CommonDialog.h"

+diff --git CPP/7zip/UI/FileManager/FM.cpp CPP/7zip/UI/FileManager/FM.cpp
+index b0b3715c9a5..14af8c32288 100755
+--- CPP/7zip/UI/FileManager/FM.cpp
++++ CPP/7zip/UI/FileManager/FM.cpp
+@@ -4,7 +4,7 @@
+ 

+ #include "../../../Common/MyWindows.h"

+ 

+-#include <Shlwapi.h>

++#include <shlwapi.h>

+ 

+ #include "../../../../C/Alloc.h"

+ #ifdef _WIN32

+diff --git CPP/7zip/UI/FileManager/FSFolderCopy.cpp CPP/7zip/UI/FileManager/FSFolderCopy.cpp
+index b0e1146816d..16208e58f6b 100755
+--- CPP/7zip/UI/FileManager/FSFolderCopy.cpp
++++ CPP/7zip/UI/FileManager/FSFolderCopy.cpp
+@@ -4,7 +4,7 @@
+ 

+ #include "../../../Common/MyWindows.h"

+ 

+-#include <WinBase.h>

++#include <winbase.h>

+ 

+ #include "../../../Common/Defs.h"

+ #include "../../../Common/StringConvert.h"

+diff --git CPP/7zip/UI/FileManager/HelpUtils.cpp CPP/7zip/UI/FileManager/HelpUtils.cpp
+index 94253a70f5c..3f4479dbddd 100755
+--- CPP/7zip/UI/FileManager/HelpUtils.cpp
++++ CPP/7zip/UI/FileManager/HelpUtils.cpp
+@@ -24,7 +24,7 @@ void ShowHelpWindow(LPCSTR)
+ #include "../../../Windows/FileName.h"

+ 

+ #else

+-#include <HtmlHelp.h>

++#include <htmlhelp.h>

+ #endif

+ 

+ #include "../../../Common/StringConvert.h"

+diff --git CPP/7zip/UI/FileManager/MyWindowsNew.h CPP/7zip/UI/FileManager/MyWindowsNew.h
+index c0fe8439b98..ba7d608b90e 100755
+--- CPP/7zip/UI/FileManager/MyWindowsNew.h
++++ CPP/7zip/UI/FileManager/MyWindowsNew.h
+@@ -5,7 +5,7 @@
+ 

+ #ifdef _MSC_VER

+ 

+-#include <ShObjIdl.h>

++#include <shobjidl.h>

+ 

+ #ifndef __ITaskbarList3_INTERFACE_DEFINED__

+ #define __ITaskbarList3_INTERFACE_DEFINED__

+diff --git CPP/7zip/UI/FileManager/Panel.cpp CPP/7zip/UI/FileManager/Panel.cpp
+index f7162e502ac..2eaf9e1266b 100755
+--- CPP/7zip/UI/FileManager/Panel.cpp
++++ CPP/7zip/UI/FileManager/Panel.cpp
+@@ -2,7 +2,7 @@
+ 

+ #include "StdAfx.h"

+ 

+-#include <WindowsX.h>

++#include <windowsx.h>

+ // #include <stdio.h>

+ 

+ #include "../../../Common/IntToString.h"

+diff --git CPP/7zip/UI/FileManager/Panel.h CPP/7zip/UI/FileManager/Panel.h
+index 5a9fef01de2..1f2b86a8e43 100755
+--- CPP/7zip/UI/FileManager/Panel.h
++++ CPP/7zip/UI/FileManager/Panel.h
+@@ -5,7 +5,7 @@
+ 

+ #include "../../../Common/MyWindows.h"

+ 

+-#include <ShlObj.h>

++#include <shlobj.h>

+ 

+ #include "../../../../C/Alloc.h"

+ 

+diff --git CPP/7zip/UI/FileManager/PanelItemOpen.cpp CPP/7zip/UI/FileManager/PanelItemOpen.cpp
+index 6af42c96923..595acdbb563 100755
+--- CPP/7zip/UI/FileManager/PanelItemOpen.cpp
++++ CPP/7zip/UI/FileManager/PanelItemOpen.cpp
+@@ -4,7 +4,7 @@
+ 

+ #include "../../../Common/MyWindows.h"

+ 

+-#include <TlHelp32.h>

++#include <tlhelp32.h>

+ 

+ #include "../../../Common/IntToString.h"

+ 

+diff --git CPP/7zip/UI/FileManager/RootFolder.cpp CPP/7zip/UI/FileManager/RootFolder.cpp
+index 6984434026f..d50c1eb832e 100755
+--- CPP/7zip/UI/FileManager/RootFolder.cpp
++++ CPP/7zip/UI/FileManager/RootFolder.cpp
+@@ -4,7 +4,7 @@
+ 

+ #include "../../../Common/MyWindows.h"

+ 

+-#include <ShlObj.h>

++#include <shlobj.h>

+ 

+ #include "../../../Common/StringConvert.h"

+ 

+diff --git CPP/7zip/UI/FileManager/StdAfx.h CPP/7zip/UI/FileManager/StdAfx.h
+index 74cfbc6deef..88960aa8c58 100755
+--- CPP/7zip/UI/FileManager/StdAfx.h
++++ CPP/7zip/UI/FileManager/StdAfx.h
+@@ -14,8 +14,8 @@
+ 

+ // #include "../../../Common/MyWindows.h"

+ 

+-// #include <CommCtrl.h>

+-// #include <ShlObj.h>

+-// #include <Shlwapi.h>

++// #include <commctrl.h>

++// #include <shlobj.h>

++// #include <shlwapi.h>

+ 

+ #endif

+diff --git CPP/7zip/UI/FileManager/SysIconUtils.cpp CPP/7zip/UI/FileManager/SysIconUtils.cpp
+index 43c613244a8..1cdf1d4c5b3 100755
+--- CPP/7zip/UI/FileManager/SysIconUtils.cpp
++++ CPP/7zip/UI/FileManager/SysIconUtils.cpp
+@@ -10,7 +10,7 @@
+ 

+ #include "SysIconUtils.h"

+ 

+-#include <ShlObj.h>

++#include <shlobj.h>

+ 

+ #define MY_CAST_FUNC  (void(*)())

+ // #define MY_CAST_FUNC

+diff --git CPP/7zip/UI/FileManager/SysIconUtils.h CPP/7zip/UI/FileManager/SysIconUtils.h
+index ba747d9ded0..2eedc4be403 100755
+--- CPP/7zip/UI/FileManager/SysIconUtils.h
++++ CPP/7zip/UI/FileManager/SysIconUtils.h
+@@ -5,7 +5,7 @@
+ 

+ #include "../../../Common/MyWindows.h"

+ 

+-#include <CommCtrl.h>

++#include <commctrl.h>

+ 

+ #include "../../../Common/MyString.h"

+ 

+diff --git CPP/7zip/UI/FileManager/SystemPage.cpp CPP/7zip/UI/FileManager/SystemPage.cpp
+index ff68172e2bf..06025259c85 100755
+--- CPP/7zip/UI/FileManager/SystemPage.cpp
++++ CPP/7zip/UI/FileManager/SystemPage.cpp
+@@ -4,7 +4,7 @@
+ 

+ #include "../../../Common/MyWindows.h"

+ 

+-#include <ShlObj.h>

++#include <shlobj.h>

+ 

+ #include "../../../Common/Defs.h"

+ #include "../../../Common/StringConvert.h"

+diff --git CPP/7zip/UI/GUI/GUI.cpp CPP/7zip/UI/GUI/GUI.cpp
+index 0cc2ee3afcc..4ffc2384668 100755
+--- CPP/7zip/UI/GUI/GUI.cpp
++++ CPP/7zip/UI/GUI/GUI.cpp
+@@ -8,7 +8,7 @@
+ 

+ #include "../../../Common/MyWindows.h"

+ 

+-#include <Shlwapi.h>

++#include <shlwapi.h>

+ 

+ #include "../../../Common/MyInitGuid.h"

+ 

+diff --git CPP/7zip/UI/GUI/StdAfx.h CPP/7zip/UI/GUI/StdAfx.h
+index 498b2fcbe4b..3c830f6a3d4 100755
+--- CPP/7zip/UI/GUI/StdAfx.h
++++ CPP/7zip/UI/GUI/StdAfx.h
+@@ -11,9 +11,9 @@
+ 

+ // #include "../../../Common/MyWindows.h"

+ 

+-// #include <CommCtrl.h>

+-// #include <ShlObj.h>

+-// #include <Shlwapi.h>

++// #include <commctrl.h>

++// #include <shlobj.h>

++// #include <shlwapi.h>

+ 

+ // #define printf(x) NO_PRINTF_(x)

+ // #define sprintf(x) NO_SPRINTF_(x)

+diff --git CPP/Common/MyInitGuid.h CPP/Common/MyInitGuid.h
+index 6895097371a..6b2f3f35d5a 100755
+--- CPP/Common/MyInitGuid.h
++++ CPP/Common/MyInitGuid.h
+@@ -29,7 +29,7 @@ Also we need IID_IUnknown that is initialized in some file for linking:
+ #include <basetyps.h>

+ #endif

+ 

+-#include <InitGuid.h>

++#include <initguid.h>

+ 

+ #ifdef UNDER_CE

+ DEFINE_GUID(IID_IUnknown,

+diff --git CPP/Common/MyWindows.h CPP/Common/MyWindows.h
+index 69eed8f6446..f48680f9d05 100755
+--- CPP/Common/MyWindows.h
++++ CPP/Common/MyWindows.h
+@@ -5,7 +5,7 @@
+ 

+ #ifdef _WIN32

+ 

+-#include <Windows.h>

++#include <windows.h>

+ 

+ #ifdef UNDER_CE

+   #undef VARIANT_TRUE

+diff --git CPP/Windows/Control/ComboBox.h CPP/Windows/Control/ComboBox.h
+index 8ab9ce5027d..8b12599b785 100755
+--- CPP/Windows/Control/ComboBox.h
++++ CPP/Windows/Control/ComboBox.h
+@@ -5,7 +5,7 @@
+ 

+ #include "../../Common/MyWindows.h"

+ 

+-#include <CommCtrl.h>

++#include <commctrl.h>

+ 

+ #include "../Window.h"

+ 

+diff --git CPP/Windows/Control/ImageList.h CPP/Windows/Control/ImageList.h
+index e59443058b8..f72ea0d1990 100755
+--- CPP/Windows/Control/ImageList.h
++++ CPP/Windows/Control/ImageList.h
+@@ -3,7 +3,7 @@
+ #ifndef __WINDOWS_CONTROL_IMAGE_LIST_H

+ #define __WINDOWS_CONTROL_IMAGE_LIST_H

+ 

+-#include <CommCtrl.h>

++#include <commctrl.h>

+ 

+ #include "../Defs.h"

+ 

+diff --git CPP/Windows/Control/ListView.h CPP/Windows/Control/ListView.h
+index 56e1100c726..cbd9cd1e21d 100755
+--- CPP/Windows/Control/ListView.h
++++ CPP/Windows/Control/ListView.h
+@@ -5,7 +5,7 @@
+ 

+ #include "../../Common/MyWindows.h"

+ 

+-#include <CommCtrl.h>

++#include <commctrl.h>

+ 

+ #include "../Window.h"

+ 

+diff --git CPP/Windows/Control/ProgressBar.h CPP/Windows/Control/ProgressBar.h
+index 741315dd4dd..f18d89c14f0 100755
+--- CPP/Windows/Control/ProgressBar.h
++++ CPP/Windows/Control/ProgressBar.h
+@@ -5,7 +5,7 @@
+ 

+ #include "../../Common/MyWindows.h"

+ 

+-#include <CommCtrl.h>

++#include <commctrl.h>

+ 

+ #include "../Window.h"

+ 

+diff --git CPP/Windows/Control/PropertyPage.h CPP/Windows/Control/PropertyPage.h
+index 97c87b3b453..551c95994c2 100755
+--- CPP/Windows/Control/PropertyPage.h
++++ CPP/Windows/Control/PropertyPage.h
+@@ -5,7 +5,7 @@
+ 

+ #include "../../Common/MyWindows.h"

+ 

+-#include <PrSht.h>

++#include <prsht.h>

+ 

+ #include "Dialog.h"

+ 

+diff --git CPP/Windows/FileIO.h CPP/Windows/FileIO.h
+index 9146491d236..e11022f82d4 100755
+--- CPP/Windows/FileIO.h
++++ CPP/Windows/FileIO.h
+@@ -17,7 +17,7 @@
+ #ifdef _WIN32

+ 

+ #if defined(_WIN32) && !defined(UNDER_CE)

+-#include <WinIoCtl.h>

++#include <winioctl.h>

+ #endif

+ 

+ #else

+diff --git CPP/Windows/ProcessUtils.h CPP/Windows/ProcessUtils.h
+index 64ebe3775e4..de46c6f52a5 100755
+--- CPP/Windows/ProcessUtils.h
++++ CPP/Windows/ProcessUtils.h
+@@ -3,7 +3,7 @@
+ #ifndef __WINDOWS_PROCESS_UTILS_H

+ #define __WINDOWS_PROCESS_UTILS_H

+ 

+-#include <Psapi.h>

++#include <psapi.h>

+ 

+ #include "../Common/MyString.h"

+ 

+diff --git CPP/Windows/SecurityUtils.h CPP/Windows/SecurityUtils.h
+index de62035ec86..18a083fc580 100755
+--- CPP/Windows/SecurityUtils.h
++++ CPP/Windows/SecurityUtils.h
+@@ -3,7 +3,7 @@
+ #ifndef __WINDOWS_SECURITY_UTILS_H

+ #define __WINDOWS_SECURITY_UTILS_H

+ 

+-#include <NTSecAPI.h>

++#include <ntsecapi.h>

+ 

+ #include "Defs.h"

+ 

+diff --git CPP/Windows/Shell.h CPP/Windows/Shell.h
+index 30388bc5a70..dc3daa5e60b 100755
+--- CPP/Windows/Shell.h
++++ CPP/Windows/Shell.h
+@@ -4,7 +4,7 @@
+ #define __WINDOWS_SHELL_H

+ 

+ #include "../Common/MyWindows.h"

+-#include <ShlObj.h>

++#include <shlobj.h>

+ 

+ #include "../Common/MyString.h"

+ 

diff --git a/nixpkgs/pkgs/tools/archivers/7zz/update.sh b/nixpkgs/pkgs/tools/archivers/7zz/update.sh
new file mode 100755
index 000000000000..1a6d38ea6097
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/7zz/update.sh
@@ -0,0 +1,51 @@
+#! /usr/bin/env nix-shell
+#! nix-shell -i bash -p coreutils gnused curl jq nix-prefetch
+set -euo pipefail
+cd "$(dirname "${BASH_SOURCE[0]}")"
+
+DRV_DIR="$PWD"
+
+OLD_VERSION="$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./default.nix)"
+# The best_release.json is not always up-to-date
+# In those cases you can force the version by calling `./update.sh <newer_version>`
+NEW_VERSION="${1:-$(curl 'https://sourceforge.net/projects/sevenzip/best_release.json' | jq '.platform_releases.linux.filename' -r | cut -d/ -f3)}"
+
+echo "comparing versions $OLD_VERSION => $NEW_VERSION"
+if [[ "$OLD_VERSION" == "$NEW_VERSION" ]]; then
+    echo "Already up to date! Doing nothing"
+    exit 0
+fi
+
+NIXPKGS_ROOT="$(realpath "$DRV_DIR/../../../..")"
+
+echo "getting free source hash"
+OLD_FREE_HASH="$(nix-instantiate --eval --strict -E "with import $NIXPKGS_ROOT {}; _7zz.src.drvAttrs.outputHash" | tr -d '"')"
+echo "getting unfree source hash"
+OLD_UNFREE_HASH="$(nix-instantiate --eval --strict -E "with import $NIXPKGS_ROOT {}; (_7zz.override { enableUnfree = true; }).src.drvAttrs.outputHash" | tr -d '"')"
+
+NEW_VERSION_FORMATTED="$(echo "$NEW_VERSION" | tr -d '.')"
+URL="https://7-zip.org/a/7z${NEW_VERSION_FORMATTED}-src.tar.xz"
+
+
+NEW_FREE_HASH=$(nix-prefetch -f "$NIXPKGS_ROOT" -E "_7zz.src" --url "$URL")
+
+NEW_UNFREE_OUT=$(nix-prefetch -f "$NIXPKGS_ROOT" -E "(_7zz.override { enableUnfree = true; }).src" --url "$URL" --output raw --print-path)
+# first line of raw output is the hash
+NEW_UNFREE_HASH="$(echo "$NEW_UNFREE_OUT" | sed -n 1p)"
+# second line of raw output is the src path
+NEW_UNFREE_SRC="$(echo "$NEW_UNFREE_OUT" | sed -n 2p)"
+# make sure to nuke the unfree src from the updater's machine
+# > the license requires that you agree to these use restrictions, or you must remove the software (source and binary) from your hard disks
+# https://fedoraproject.org/wiki/Licensing:Unrar
+nix-store --delete "$NEW_UNFREE_SRC"
+
+
+echo "updating version"
+sed -i "s/version = \"$OLD_VERSION\";/version = \"$NEW_VERSION\";/" "$DRV_DIR/default.nix"
+
+echo "updating free hash"
+sed -i "s@free = \"$OLD_FREE_HASH\";@free = \"$NEW_FREE_HASH\";@" "$DRV_DIR/default.nix"
+echo "updating unfree hash"
+sed -i "s@unfree = \"$OLD_UNFREE_HASH\";@unfree = \"$NEW_UNFREE_HASH\";@" "$DRV_DIR/default.nix"
+
+echo "done"
diff --git a/nixpkgs/pkgs/tools/archivers/afio/0001-makefile-fix-installation.patch b/nixpkgs/pkgs/tools/archivers/afio/0001-makefile-fix-installation.patch
new file mode 100644
index 000000000000..d52995281347
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/afio/0001-makefile-fix-installation.patch
@@ -0,0 +1,45 @@
+From 428c6e0eb604b63a67fda6af445c10c8ae3c1826 Mon Sep 17 00:00:00 2001
+From: Philipp Gesang <phg@phi-gamma.net>
+Date: Sun, 27 Jan 2019 21:37:13 +0100
+Subject: [PATCH] makefile: fix installation
+
+- comment hard-coded $(CC)
+- avoid full paths during install
+- set proper permissions
+---
+ Makefile | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 9268c6f..0797579 100644
+--- a/Makefile
++++ b/Makefile
+@@ -76,7 +76,7 @@ MW=-Wformat -Werror=format-security -Wall
+ 
+ CFLAGS1 = -Wall -Wstrict-prototypes -s -O2 -fomit-frame-pointer -Wno-unused-result $(LARGEFILEFLAGS) $(MW)
+ 
+-CC=gcc
++#CC=gcc
+ 
+ # also using contents of usin CPPFLAGS, CFLAGS, LDFLAGS out of environment
+ # variables, if they exist
+@@ -94,9 +94,14 @@ clean:
+ 	rm -f regtest/statsize regtest/statsize64
+ 	cd regtest; /bin/sh regtest.clean
+ 
++ifndef DESTDIR
++install:
++	$(error Please specify install prefix as $$DESTDIR)
++else
+ install: afio
+-	cp afio /usr/local/bin
+-	cp afio.1 /usr/share/man/man1
++	install -Dm755 afio $(DESTDIR)/bin/afio
++	install -Dm644 afio.1 $(DESTDIR)/share/man/man1/afio.1
++endif
+ 
+ # generate default list of -E extensions from manpage
+ # note: on sun, I had to change awk command below to nawk or gawk
+-- 
+2.18.1
+
diff --git a/nixpkgs/pkgs/tools/archivers/afio/default.nix b/nixpkgs/pkgs/tools/archivers/afio/default.nix
new file mode 100644
index 000000000000..7ef374b5bfe6
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/afio/default.nix
@@ -0,0 +1,33 @@
+{ lib, stdenv, fetchFromGitHub } :
+
+stdenv.mkDerivation rec {
+  version = "2.5.2";
+  pname = "afio";
+
+  src = fetchFromGitHub {
+    owner = "kholtman";
+    repo = "afio";
+    rev = "v${version}";
+    sha256 = "1vbxl66r5rp5a1qssjrkfsjqjjgld1cq57c871gd0m4qiq9rmcfy";
+  };
+
+  /*
+   * A patch to simplify the installation and for removing the
+   * hard coded dependency on GCC.
+   */
+  patches = [ ./0001-makefile-fix-installation.patch ];
+
+  installFlags = [ "DESTDIR=$(out)" ];
+
+  meta = {
+    homepage = "https://github.com/kholtman/afio";
+    description = "Fault tolerant cpio archiver targeting backups";
+    platforms = lib.platforms.all;
+    /*
+     * Licensing is complicated due to the age of the code base, but
+     * generally free. See the file ``afio_license_issues_v5.txt`` for
+     * a comprehensive discussion.
+     */
+    license = lib.licenses.free;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/arc_unpacker/default.nix b/nixpkgs/pkgs/tools/archivers/arc_unpacker/default.nix
new file mode 100644
index 000000000000..ee40a7a5ab4a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/arc_unpacker/default.nix
@@ -0,0 +1,89 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, fetchpatch
+, cmake
+, makeWrapper
+, boost
+, libpng
+, libiconv
+, libjpeg
+, zlib
+, openssl
+, libwebp
+, catch2
+}:
+
+stdenv.mkDerivation {
+  pname = "arc_unpacker";
+  version = "unstable-2021-08-06";
+
+  src = fetchFromGitHub {
+    owner = "vn-tools";
+    repo = "arc_unpacker";
+    rev = "456834ecf2e5686813802c37efd829310485c57d";
+    hash = "sha256-STbdWH7Mr3gpOrZvujblYrIIKEWBHzy1/BaNuh4teI8=";
+  };
+
+  patches = [
+    (fetchpatch {
+      name = "failing_tests.patch";
+      url = "https://aur.archlinux.org/cgit/aur.git/plain/failing_tests.patch?h=arc_unpacker-git&id=bda1ad9f69e6802e703b2e6913d71a36d76cfef9";
+      hash = "sha256-bClACsf/+SktyLAPtt7EcSqprkw8JVIi1ZLpcJcv9IE=";
+    })
+  ];
+
+  postPatch = ''
+    cp ${catch2}/include/catch2/catch.hpp tests/test_support/catch.h
+    sed '1i#include <limits>' -i src/dec/eagls/pak_archive_decoder.cc # gcc12
+  '';
+
+  nativeBuildInputs = [
+    cmake
+    makeWrapper
+    catch2
+  ];
+
+  buildInputs = [
+    boost
+    libiconv
+    libjpeg
+    libpng
+    libwebp
+    openssl
+    zlib
+  ];
+
+  checkPhase = ''
+    runHook preCheck
+
+    pushd ..
+    ./build/run_tests
+    popd
+
+    runHook postCheck
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p $out/bin $out/share/doc/arc_unpacker $out/libexec/arc_unpacker
+    cp arc_unpacker $out/libexec/arc_unpacker/arc_unpacker
+    cp ../GAMELIST.{htm,js} $out/share/doc/arc_unpacker
+    cp -r ../etc $out/libexec/arc_unpacker
+    makeWrapper $out/libexec/arc_unpacker/arc_unpacker $out/bin/arc_unpacker
+
+    runHook postInstall
+  '';
+
+  # A few tests fail on aarch64-linux
+  doCheck = !(stdenv.isLinux && stdenv.isAarch64);
+
+  meta = with lib; {
+    description = "A tool to extract files from visual novel archives";
+    homepage = "https://github.com/vn-tools/arc_unpacker";
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ midchildan ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/arj/default.nix b/nixpkgs/pkgs/tools/archivers/arj/default.nix
new file mode 100644
index 000000000000..6f365e226e20
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/arj/default.nix
@@ -0,0 +1,155 @@
+{stdenv, lib, fetchurl, fetchpatch, autoreconfHook}:
+
+stdenv.mkDerivation rec {
+  pname = "arj";
+  version = "3.10.22";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/${pname}/${pname}-${version}.tar.gz";
+    sha256 = "1nx7jqxwqkihhdmdbahhzqhjqshzw1jcsvwddmxrwrn8rjdlr7jq";
+  };
+
+  patches = [
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/001_arches_align.patch";
+      sha256 = "0i3qclm2mh98c04rqpx1r4qagd3wpxlkj7lvq0ddpkmr8bm0fh0m";
+    })
+
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/002_no_remove_static_const.patch";
+      sha256 = "0zfjqmjsj0y1kfzxbp29v6nxq5qwgazhb9clqc544sm5zn0bdp8n";
+    })
+
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/003_64_bit_clean.patch";
+      sha256 = "0mda9fkaqf2s1xl6vlbkbq20362h3is9dpml9kfmacpbifl4dx3n";
+    })
+
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/004_parallel_build.patch";
+      sha256 = "0gam6k7jknzmbjlf1r6c9kjh5s5h76pd31v59cnaqiycwiy8z6q9";
+    })
+
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/005_use_system_strnlen.patch";
+      sha256 = "0q0ypm8mdsxd0rl1k0id6fdx5m7mvqgwcla4r250cmc6zqzpib6d";
+    })
+
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/006_use_safe_strcpy.patch";
+      sha256 = "1garad95s34cix3kd77lz37andrcnz19glzkfdnkjaq7ldvzwikc";
+    })
+
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/hurd_no_fcntl_getlk.patch";
+      sha256 = "0b3hpn4qypimrw9ar2n4h24886sl6pmim4lb4ly1wqcq0f73arva";
+    })
+
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/security_format.patch";
+      sha256 = "0q67cvln55p38bm0xwd2cgppqmkp2nfar2pg1zj78f7ncn35lbvf";
+    })
+
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/doc_refer_robert_k_jung.patch";
+      sha256 = "1wxdx0m6a9vdvjlaycwsissn75l1ni7grg8n6qmkynz2vrcvgzb1";
+    })
+
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/gnu_build_fix.patch";
+      sha256 = "19ycp1rak7l6ql28m50v95ls621w3sl8agw5r5va73svkgh8hc3g";
+    })
+
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/gnu_build_flags.patch";
+      sha256 = "1jw1y9i9lw1idgi4l9cycwsql1hcz1m4f3k2iybwsgx0acaw695q";
+    })
+
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/gnu_build_strip.patch";
+      sha256 = "1b18khj6cxnjyqk2ycygwqlcs20hrsbf4h6bckl99dxnpbq5blxi";
+    })
+
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/gnu_build_pie.patch";
+      sha256 = "1jqswxgc1plipblf055n9175fbanfi6fb67lnzk8dcvxjn227fs3";
+    })
+
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/self_integrity_64bit.patch";
+      sha256 = "0s5zdq81a0f83hdg9hy6lqn3xvckx9y9r20awczm9mbf11vi01cb";
+    })
+
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/security-afl.patch";
+      sha256 = "0yajcwpghij8wg21a0kkp3f9x7anz5m121jx2vnkyn04bvi9541a";
+    })
+
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/security-traversal-dir.patch";
+      sha256 = "10lv3867k0wm2s0cyf40hkxfqbjaxm4aph5ivk2q2rjkracrn2y4";
+    })
+
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/security-traversal-symlink.patch";
+      sha256 = "095pdfskxwh0jnyy31dpz10s2ppv8n7lvvn4q722y3g71d0c79qq";
+    })
+
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/out-of-bounds-read.patch";
+      sha256 = "0ps9lqkbqzlhzr2bnr47sir431z1nywr7nagkmk42iki4d96v0jq";
+    })
+
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/remove_build_date.patch";
+      sha256 = "1vjlfq6firxpj068l9acyqs77mfydn1rwgr2jmxgsy9mq0fw1dsc";
+    })
+
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/reproducible_help_archive.patch";
+      sha256 = "0l3qi9f140pwc6fk8qdbxx4g9d8zlf45asimmr8wfpbi4pf59n8i";
+    })
+
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/gnu_build_cross.patch";
+      sha256 = "1vb0vbh3jbxj192q47vg3f41l343ghcz2ypbrrm2bkbpwm5cl8qr";
+    })
+
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/fix-time_t-usage.patch";
+      sha256 = "012c6pnf5y4jwn715kxn3vjy088rm905959j6yh8bslyx84qaijv";
+    })
+
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/gnu_build_fix_autoreconf.patch";
+      sha256 = "0yhxbdasnbqcg1nyx2379fpbr7fmdlv4n2nlxrv1z1vbc7rlvw9d";
+    })
+  ];
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  postPatch = lib.optionalString stdenv.isDarwin ''
+    substituteInPlace environ.c \
+        --replace "  #include <sys/statfs.h>" "  #include <sys/mount.h>"
+  '';
+
+  preAutoreconf = ''
+    cd gnu
+  '';
+
+  postConfigure = ''
+    cd ..
+  '';
+
+  meta = with lib; {
+    description = "Open-source implementation of the world-famous ARJ archiver";
+    longDescription = ''
+      This version of ARJ has been created with an intent to preserve maximum
+      compatibility and retain the feature set of the original ARJ archiver as
+      provided by ARJ Software, Inc.
+    '';
+    license = licenses.gpl2Plus;
+    maintainers = [ maintainers.sander ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/atool/default.nix b/nixpkgs/pkgs/tools/archivers/atool/default.nix
new file mode 100644
index 000000000000..8303a1b4277b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/atool/default.nix
@@ -0,0 +1,21 @@
+{lib, stdenv, fetchurl, perl, bash}:
+
+stdenv.mkDerivation rec {
+  pname = "atool";
+  version = "0.39.0";
+
+  src = fetchurl {
+    url = "mirror://savannah/atool/atool-${version}.tar.gz";
+    sha256 = "aaf60095884abb872e25f8e919a8a63d0dabaeca46faeba87d12812d6efc703b";
+  };
+
+  buildInputs = [ perl ];
+  configureScript = "${bash}/bin/bash configure";
+
+  meta = {
+    homepage = "https://www.nongnu.org/atool";
+    description = "Archive command line helper";
+    platforms = lib.platforms.unix;
+    license = lib.licenses.gpl3;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/bomutils/default.nix b/nixpkgs/pkgs/tools/archivers/bomutils/default.nix
new file mode 100644
index 000000000000..1b147d10ec28
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/bomutils/default.nix
@@ -0,0 +1,33 @@
+{ lib, stdenv
+, fetchFromGitHub
+}:
+
+stdenv.mkDerivation rec {
+  pname = "bomutils";
+  version = "0.2";
+
+  src = fetchFromGitHub {
+    owner = "hogliux";
+    repo = pname;
+    rev = version;
+    sha256 = "1i7nhbq1fcbrjwfg64znz8p4l7662f7qz2l6xcvwd5z93dnmgmdr";
+  };
+
+  makeFlags = [
+    "PREFIX=$(out)"
+    "CXX=${stdenv.cc.targetPrefix}c++"
+  ];
+
+  # fix
+  # src/lsbom.cpp:70:10: error: reference to 'data' is ambiguous
+  # which refers to std::data from C++17
+  env.NIX_CFLAGS_COMPILE = toString [ "-std=c++14" ];
+
+  meta = with lib; {
+    homepage = "https://github.com/hogliux/bomutils";
+    description = "Open source tools to create bill-of-materials files used in macOS installers";
+    platforms = platforms.all;
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ prusnak ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/cabextract/default.nix b/nixpkgs/pkgs/tools/archivers/cabextract/default.nix
new file mode 100644
index 000000000000..6268a7826e59
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/cabextract/default.nix
@@ -0,0 +1,25 @@
+{ lib, stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  pname = "cabextract";
+  version = "1.11";
+
+  src = fetchurl {
+    url = "https://www.cabextract.org.uk/cabextract-${version}.tar.gz";
+    sha256 = "sha256-tVRtsRVeTHGP89SyeFc2BPMN1kw8W/1GV80Im4I6OsY=";
+  };
+
+  # Let's assume that fnmatch works for cross-compilation, otherwise it gives an error:
+  # undefined reference to `rpl_fnmatch'.
+  configureFlags = lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
+    "ac_cv_func_fnmatch_works=yes"
+  ];
+
+  meta = with lib; {
+    homepage = "https://www.cabextract.org.uk/";
+    description = "Free Software for extracting Microsoft cabinet files";
+    platforms = platforms.all;
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ pSub ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/cpio/default.nix b/nixpkgs/pkgs/tools/archivers/cpio/default.nix
new file mode 100644
index 000000000000..0fe726f09977
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/cpio/default.nix
@@ -0,0 +1,42 @@
+{ lib
+, stdenv
+, fetchurl
+
+# for passthru.tests
+, git
+, libguestfs
+, nixosTests
+, rpm
+}:
+
+stdenv.mkDerivation rec {
+  pname = "cpio";
+  version = "2.14";
+
+  src = fetchurl {
+    url = "mirror://gnu/cpio/cpio-${version}.tar.bz2";
+    sha256 = "/NwV1g9yZ6b8fvzWudt7bIlmxPL7u5ZMJNQTNv0/LBI=";
+  };
+
+  separateDebugInfo = true;
+
+  preConfigure = lib.optionalString stdenv.isCygwin ''
+    sed -i gnu/fpending.h -e 's,include <stdio_ext.h>,,'
+  '';
+
+  enableParallelBuilding = true;
+
+  passthru.tests = {
+    inherit libguestfs rpm;
+    git = git.tests.withInstallCheck;
+    initrd = nixosTests.systemd-initrd-simple;
+  };
+
+  meta = with lib; {
+    homepage = "https://www.gnu.org/software/cpio/";
+    description = "A program to create or extract from cpio archives";
+    license = licenses.gpl3;
+    platforms = platforms.all;
+    priority = 6; # resolves collision with gnutar's "libexec/rmt"
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/cromfs/default.nix b/nixpkgs/pkgs/tools/archivers/cromfs/default.nix
new file mode 100644
index 000000000000..899640d90c45
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/cromfs/default.nix
@@ -0,0 +1,32 @@
+{ lib, stdenv, fetchurl, pkg-config, fuse, perl }:
+
+stdenv.mkDerivation rec {
+  pname = "cromfs";
+  version = "1.5.10.2";
+
+  src = fetchurl {
+    url = "https://bisqwit.iki.fi/src/arch/cromfs-${version}.tar.bz2";
+    sha256 = "0xy2x1ws1qqfp7hfj6yzm80zhrxzmhn0w2yns77im1lmd2h18817";
+  };
+
+  postPatch = "patchShebangs configure";
+
+  installPhase = ''
+    install -d $out/bin
+    install cromfs-driver $out/bin
+    install util/cvcromfs $out/bin
+    install util/mkcromfs $out/bin
+    install util/unmkcromfs $out/bin
+  '';
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ fuse perl ];
+
+  meta = with lib; {
+    description = "FUSE Compressed ROM filesystem with lzma";
+    homepage = "https://bisqwit.iki.fi/source/cromfs.html";
+    license = licenses.gpl3;
+    maintainers = [ maintainers.viric ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/ctrtool/default.nix b/nixpkgs/pkgs/tools/archivers/ctrtool/default.nix
new file mode 100644
index 000000000000..2408f3cf6d6a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/ctrtool/default.nix
@@ -0,0 +1,31 @@
+{ lib, stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  pname = "ctrtool";
+  version = "0.7";
+
+  src = fetchFromGitHub {
+    owner  = "jakcron";
+    repo   = "Project_CTR";
+    rev    = "ctrtool-v${version}";
+    sha256 = "07aayck82w5xcp3si35d7ghybmrbqw91fqqvmbpjrjcixc6m42z7";
+  };
+
+  sourceRoot = "${src.name}/ctrtool";
+
+  makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" "CXX=${stdenv.cc.targetPrefix}c++"];
+  enableParallelBuilding = true;
+
+  installPhase = "
+    mkdir $out/bin -p
+    cp ctrtool${stdenv.hostPlatform.extensions.executable} $out/bin/
+  ";
+
+  meta = with lib; {
+    license = licenses.mit;
+    description = "A tool to extract data from a 3ds rom";
+    platforms = platforms.linux;
+    maintainers = [ maintainers.marius851000 ];
+  };
+
+}
diff --git a/nixpkgs/pkgs/tools/archivers/dumpnar/default.nix b/nixpkgs/pkgs/tools/archivers/dumpnar/default.nix
new file mode 100644
index 000000000000..e2285574a9a6
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/dumpnar/default.nix
@@ -0,0 +1,26 @@
+{ lib, stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  pname = "dumpnar";
+  version = "unstable-2023-01-01";
+
+  src = fetchFromGitHub {
+    owner = "stephank";
+    repo = "dumpnar";
+    rev = "7b05e204264183532e8592ad132f74ddf05bc428";
+    hash = "sha256-762vgCn2d6QoXRBjpe/SyHKgyQJAV0sEl1prcyf/ClE=";
+  };
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp dumpnar $out/bin/
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/stephank/dumpnar";
+    description = "Minimal tool to produce a Nix NAR archive.";
+    license = licenses.lgpl2Plus;
+    platforms = platforms.all;
+    maintainers = [ maintainers.stephank ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/fsarchiver/default.nix b/nixpkgs/pkgs/tools/archivers/fsarchiver/default.nix
new file mode 100644
index 000000000000..e9265108bb95
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/fsarchiver/default.nix
@@ -0,0 +1,44 @@
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config
+, zlib, bzip2, lzo, lz4, zstd, xz
+, libgcrypt, e2fsprogs, util-linux, libgpg-error }:
+
+let
+  version = "0.8.7";
+
+in stdenv.mkDerivation {
+  pname = "fsarchiver";
+  inherit version;
+
+  src = fetchFromGitHub {
+    owner = "fdupoux";
+    repo = "fsarchiver";
+    rev = version;
+    sha256 = "sha256-1ZIqFgB05gV1L7P/AIL4qfYT4cNMp75QElEM64BXyO8=";
+  };
+
+  nativeBuildInputs = [
+    autoreconfHook pkg-config
+  ];
+
+  buildInputs = [
+    zlib bzip2 xz lzo lz4 zstd xz
+    libgcrypt e2fsprogs util-linux libgpg-error
+  ];
+
+  meta = with lib; {
+    description = "File system archiver for linux";
+    longDescription = ''
+      FSArchiver is a system tool that allows you to save the contents of a
+      file-system to a compressed archive file. The file-system can be restored
+      on a partition which has a different size and it can be restored on a
+      different file-system. Unlike tar/dar, FSArchiver also creates the
+      file-system when it extracts the data to partitions. Everything is
+      checksummed in the archive in order to protect the data. If the archive is
+      corrupt, you just loose the current file, not the whole archive.
+    '';
+    homepage = "https://www.fsarchiver.org/";
+    license = licenses.lgpl2;
+    maintainers = with maintainers; [ ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/gbl/default.nix b/nixpkgs/pkgs/tools/archivers/gbl/default.nix
new file mode 100644
index 000000000000..90c66e8ac7c5
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/gbl/default.nix
@@ -0,0 +1,56 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, rustPlatform
+, fetchpatch
+, pkg-config
+, openssl
+, testers
+, gbl
+, Security
+}:
+
+rustPlatform.buildRustPackage rec {
+  pname = "gbl";
+  version = "0.3.1";
+
+  src = fetchFromGitHub {
+    owner = "dac-gmbh";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "sha256-Xzx14fvYWTZYM9Pnowf1M3D0PTPRLwsXHUj/PJskRWw=";
+  };
+
+  cargoPatches = [
+    # update ring to fix building on Mac M1
+    # https://github.com/dac-gmbh/gbl/pull/64
+    (fetchpatch {
+      url = "https://github.com/raboof/gbl/commit/17e154d66932af59abe8677309792606b7f64c7d.patch";
+      sha256 = "sha256-5Itoi86Q+9FzSTtnggODKPwwYPp5BpIVgR2vYMLHBts=";
+    })
+    # Upstream does not include Cargo.lock, even though this is recommended for applications.
+    (fetchpatch {
+      url = "https://github.com/raboof/gbl/commit/9423d36ee3168bca8db7a7cb65611dc7ddc2daf0.patch";
+      sha256 = "sha256-zwHXgUVkAYiQs/AT/pINnZoECoXzh+9astWMYENGTL8=";
+    })
+  ];
+
+  cargoSha256 = "sha256-CeGLSseKUe2XudRqZm5Y7o7ZLDtDBg/MFunOGqxFZGM=";
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ Security ];
+
+  passthru.tests.version =
+    testers.testVersion { package = gbl; };
+
+  meta = with lib; {
+    description = "GBL Firmware file manipulation";
+    longDescription = ''
+      Utility to read, create and manipulate `.gbl` firmware update
+      files targeting the Silicon Labs Gecko Bootloader.
+    '';
+    homepage = "https://github.com/jonas-schievink/gbl";
+    license = licenses.mit;
+    maintainers = [ maintainers.raboof ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/gnutar/default.nix b/nixpkgs/pkgs/tools/archivers/gnutar/default.nix
new file mode 100644
index 000000000000..9be1ea7f4d44
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/gnutar/default.nix
@@ -0,0 +1,73 @@
+{ lib, stdenv, fetchurl, autoreconfHook, acl }:
+
+# Note: this package is used for bootstrapping fetchurl, and thus
+# cannot use fetchpatch! All mutable patches (generated by GitHub or
+# cgit) that are needed here should be included directly in Nixpkgs as
+# files.
+
+stdenv.mkDerivation rec {
+  pname = "gnutar";
+  version = "1.34";
+
+  src = fetchurl {
+    url = "mirror://gnu/tar/tar-${version}.tar.xz";
+    sha256 = "sha256-Y769JoecXh7qQ1Lw0DyZH5Zq6z3es8dEXJAlaNVBHSg=";
+  };
+
+  # avoid retaining reference to CF during stdenv bootstrap
+  configureFlags = lib.optionals stdenv.isDarwin [
+    "gt_cv_func_CFPreferencesCopyAppValue=no"
+    "gt_cv_func_CFLocaleCopyCurrent=no"
+    "gt_cv_func_CFLocaleCopyPreferredLanguages=no"
+  ];
+
+  # gnutar tries to call into gettext between `fork` and `exec`,
+  # which is not safe on darwin.
+  # see http://article.gmane.org/gmane.os.macosx.fink.devel/21882
+  postPatch = lib.optionalString stdenv.isDarwin ''
+    substituteInPlace src/system.c --replace '_(' 'N_('
+  '';
+
+  outputs = [ "out" "info" ];
+
+  nativeBuildInputs = lib.optional stdenv.isDarwin autoreconfHook;
+  buildInputs = lib.optional stdenv.isLinux acl;
+
+  # May have some issues with root compilation because the bootstrap tool
+  # cannot be used as a login shell for now.
+  FORCE_UNSAFE_CONFIGURE = lib.optionalString (stdenv.hostPlatform.system == "armv7l-linux" || stdenv.isSunOS) "1";
+
+  preConfigure = if stdenv.isCygwin then ''
+    sed -i gnu/fpending.h -e 's,include <stdio_ext.h>,,'
+  '' else null;
+
+  doCheck = false; # fails
+  doInstallCheck = false; # fails
+
+  meta = {
+    description = "GNU implementation of the `tar' archiver";
+    longDescription = ''
+      The Tar program provides the ability to create tar archives, as
+      well as various other kinds of manipulation.  For example, you
+      can use Tar on previously created archives to extract files, to
+      store additional files, or to update or list files which were
+      already stored.
+
+      Initially, tar archives were used to store files conveniently on
+      magnetic tape.  The name "Tar" comes from this use; it stands
+      for tape archiver.  Despite the utility's name, Tar can direct
+      its output to available devices, files, or other programs (using
+      pipes), it can even access remote devices or files (as
+      archives).
+    '';
+    homepage = "https://www.gnu.org/software/tar/";
+
+    license = lib.licenses.gpl3Plus;
+
+    maintainers = [ ];
+    mainProgram = "tar";
+    platforms = lib.platforms.all;
+
+    priority = 10;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/innoextract/default.nix b/nixpkgs/pkgs/tools/archivers/innoextract/default.nix
new file mode 100644
index 000000000000..d2e1bebb3676
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/innoextract/default.nix
@@ -0,0 +1,36 @@
+{ lib, stdenv, fetchurl, cmake, makeWrapper
+, boost, xz
+, withGog ? false, unar ? null }:
+
+stdenv.mkDerivation rec {
+  pname = "innoextract";
+  version = "1.9";
+
+  src = fetchurl {
+    url = "https://constexpr.org/innoextract/files/innoextract-${version}.tar.gz";
+    sha256 = "09l1z1nbl6ijqqwszdwch9mqr54qb7df0wp2sd77v17dq6gsci33";
+  };
+
+  buildInputs = [ xz boost ];
+
+  # Python is reported as missing during the build, however
+  # including Python does not change the output.
+
+  nativeBuildInputs = [ cmake makeWrapper ];
+
+  strictDeps = true;
+
+  # we need unar to for multi-archive extraction
+  postFixup = lib.optionalString withGog ''
+    wrapProgram $out/bin/innoextract \
+      --prefix PATH : ${lib.makeBinPath [ unar ]}
+  '';
+
+  meta = with lib; {
+    description = "A tool to unpack installers created by Inno Setup";
+    homepage = "https://constexpr.org/innoextract/";
+    license = licenses.zlib;
+    maintainers = with maintainers; [ abbradar ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/lha/default.nix b/nixpkgs/pkgs/tools/archivers/lha/default.nix
new file mode 100644
index 000000000000..f6b5c2bd1350
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/lha/default.nix
@@ -0,0 +1,27 @@
+{stdenv, lib, fetchFromGitHub, autoreconfHook}:
+
+stdenv.mkDerivation {
+  pname = "lha";
+  version = "unstable-2021-01-07";
+
+  src = fetchFromGitHub {
+    owner = "jca02266";
+    repo = "lha";
+    rev = "03475355bc6311f7f816ea9a88fb34a0029d975b";
+    sha256 = "18w2x0g5yq89yxkxh1fmb05lz4hw7a3b4jmkk95gvh11mwbbr5lm";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  meta = with lib; {
+    description = "LHa is an archiver and compressor using the LZSS and Huffman encoding compression algorithms";
+    platforms = platforms.unix;
+    maintainers = [ maintainers.sander ];
+    # Some of the original LhA code has been rewritten and the current author
+    # considers adopting a "true" free and open source license for it.
+    # However, old code is still covered by the original LHa license, which is
+    # not a free software license (it has additional requirements on commercial
+    # use).
+    license = licenses.unfree;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/maxcso/default.nix b/nixpkgs/pkgs/tools/archivers/maxcso/default.nix
new file mode 100644
index 000000000000..1e7fe73728de
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/maxcso/default.nix
@@ -0,0 +1,26 @@
+{ lib, stdenv, fetchFromGitHub, libuv, lz4, zlib }:
+
+stdenv.mkDerivation rec {
+  pname = "maxcso";
+  version = "1.13.0";
+
+  src = fetchFromGitHub {
+    owner = "unknownbrackets";
+    repo = "maxcso";
+    rev = "v${version}";
+    sha256 = "sha256-6LjR1ZMZsi6toz9swPzNmSAlrUykwvVdYi1mR8Ctq5U=";
+  };
+
+  buildInputs = [ libuv lz4 zlib ];
+
+  makeFlags = [ "PREFIX=$(out)" ];
+
+  meta = with lib; {
+    homepage = "https://github.com/unknownbrackets/maxcso";
+    description =
+      "A fast ISO to CSO compression program for use with PSP and PS2 emulators, which uses multiple algorithms for best compression ratio";
+    maintainers = with maintainers; [ david-sawatzke ];
+    platforms = platforms.linux ++ platforms.darwin;
+    license = licenses.isc;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/ndstool/default.nix b/nixpkgs/pkgs/tools/archivers/ndstool/default.nix
new file mode 100644
index 000000000000..de7f02ce846a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/ndstool/default.nix
@@ -0,0 +1,24 @@
+{ lib, stdenv, fetchFromGitHub, autoconf, automake }:
+
+stdenv.mkDerivation rec {
+  pname = "ndstool";
+  version = "2.1.2";
+
+  src = fetchFromGitHub {
+    owner = "devkitPro";
+    repo = "ndstool";
+    rev = "v${version}";
+    sha256 = "0isnm0is5k6dgi2n2c3mysyr5hpwikp5g0s3ix7ms928z04l8ccm";
+  };
+
+  nativeBuildInputs = [ autoconf automake ];
+
+  preConfigure = "./autogen.sh";
+
+  meta = {
+    homepage = "https://github.com/devkitPro/ndstool";
+    description = "A tool to unpack and repack nds rom";
+    maintainers = [ lib.maintainers.marius851000 ];
+    license = lib.licenses.gpl3;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/p7zip/default.nix b/nixpkgs/pkgs/tools/archivers/p7zip/default.nix
new file mode 100644
index 000000000000..23ffdcc41a70
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/p7zip/default.nix
@@ -0,0 +1,76 @@
+{ lib, stdenv, fetchFromGitHub, enableUnfree ? false }:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "p7zip";
+  version = "17.05";
+
+  src = fetchFromGitHub {
+    owner = "p7zip-project";
+    repo = "p7zip";
+    rev = "v${finalAttrs.version}";
+    sha256 = {
+      free = "sha256-5r7M9BVcAryZNTkqJ/BfHnSSWov1PwoZhUnLBwEbJoA=";
+      unfree = "sha256-z3qXgv/TkNRbb85Ew1OcJNxoyssfzHShc0b0/4NZOb0=";
+    }.${if enableUnfree then "unfree" else "free"};
+    # remove the unRAR related code from the src drv
+    # > the license requires that you agree to these use restrictions,
+    # > or you must remove the software (source and binary) from your hard disks
+    # https://fedoraproject.org/wiki/Licensing:Unrar
+    postFetch = lib.optionalString (!enableUnfree) ''
+      rm -r $out/CPP/7zip/Compress/Rar*
+      find $out -name makefile'*' -exec sed -i '/Rar/d' {} +
+    '';
+  };
+
+  # Default makefile is full of impurities on Darwin. The patch doesn't hurt Linux so I'm leaving it unconditional
+  postPatch = ''
+    sed -i '/CC=\/usr/d' makefile.macosx_llvm_64bits
+    # Avoid writing timestamps into compressed manpages
+    # to maintain determinism.
+    substituteInPlace install.sh --replace 'gzip' 'gzip -n'
+    chmod +x install.sh
+
+    # I think this is a typo and should be CXX? Either way let's kill it
+    sed -i '/XX=\/usr/d' makefile.macosx_llvm_64bits
+  '' + lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
+    substituteInPlace makefile.machine \
+      --replace 'CC=gcc'  'CC=${stdenv.cc.targetPrefix}gcc' \
+      --replace 'CXX=g++' 'CXX=${stdenv.cc.targetPrefix}g++'
+  '';
+
+  preConfigure = ''
+    buildFlags=all3
+  '' + lib.optionalString stdenv.isDarwin ''
+    cp makefile.macosx_llvm_64bits makefile.machine
+  '';
+
+  enableParallelBuilding = true;
+  env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=c++11-narrowing";
+
+  makeFlags = [
+    "DEST_BIN=${placeholder "out"}/bin"
+    "DEST_SHARE=${placeholder "lib"}/lib/p7zip"
+    "DEST_MAN=${placeholder "man"}/share/man"
+    "DEST_SHARE_DOC=${placeholder "doc"}/share/doc/p7zip"
+  ];
+
+  outputs = [ "out" "lib" "doc" "man" ];
+
+  setupHook = ./setup-hook.sh;
+  passthru.updateScript = ./update.sh;
+
+  meta = with lib; {
+    homepage = "https://github.com/p7zip-project/p7zip";
+    description = "A new p7zip fork with additional codecs and improvements (forked from https://sourceforge.net/projects/p7zip/)";
+    license = with licenses;
+      # p7zip code is largely lgpl2Plus
+      # CPP/7zip/Compress/LzfseDecoder.cpp is bsd3
+      [ lgpl2Plus /* and */ bsd3 ] ++
+      # and CPP/7zip/Compress/Rar* are unfree with the unRAR license restriction
+      # the unRAR compression code is disabled by default
+      lib.optionals enableUnfree [ unfree ];
+    maintainers = with maintainers; [ raskin jk ];
+    platforms = platforms.unix;
+    mainProgram = "7z";
+  };
+})
diff --git a/nixpkgs/pkgs/tools/archivers/p7zip/setup-hook.sh b/nixpkgs/pkgs/tools/archivers/p7zip/setup-hook.sh
new file mode 100644
index 000000000000..4dc88f07c0bd
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/p7zip/setup-hook.sh
@@ -0,0 +1,5 @@
+unpackCmdHooks+=(_try7zip)
+_try7zip() {
+    if ! [[ "$curSrc" =~ \.7z$ ]]; then return 1; fi
+    7z x "$curSrc"
+}
diff --git a/nixpkgs/pkgs/tools/archivers/p7zip/update.sh b/nixpkgs/pkgs/tools/archivers/p7zip/update.sh
new file mode 100755
index 000000000000..9ba67894b806
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/p7zip/update.sh
@@ -0,0 +1,47 @@
+#! /usr/bin/env nix-shell
+#! nix-shell -i bash -p coreutils gnused curl jq
+set -euo pipefail
+cd "$(dirname "${BASH_SOURCE[0]}")"
+
+DRV_DIR="$PWD"
+
+OLD_VERSION="$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./default.nix)"
+
+NEW_VERSION="$(curl https://api.github.com/repos/p7zip-project/p7zip/releases/latest | jq .tag_name -r | tr -d 'v')"
+
+echo "comparing versions $OLD_VERSION => $NEW_VERSION"
+if [[ "$OLD_VERSION" == "$NEW_VERSION" ]]; then
+    echo "Already up to date! Doing nothing"
+    exit 0
+fi
+
+NIXPKGS_ROOT="$(realpath "$DRV_DIR/../../../..")"
+
+echo "getting free source hash"
+OLD_FREE_HASH="$(nix-instantiate --eval --strict -E "with import $NIXPKGS_ROOT {}; p7zip.src.drvAttrs.outputHash" | tr -d '"')"
+echo "getting unfree source hash"
+OLD_UNFREE_HASH="$(nix-instantiate --eval --strict -E "with import $NIXPKGS_ROOT {}; (p7zip.override { enableUnfree = true; }).src.drvAttrs.outputHash" | tr -d '"')"
+
+
+NEW_FREE_HASH=$(nix-prefetch -f "$NIXPKGS_ROOT" -E "p7zip.src" --rev "v$NEW_VERSION")
+
+NEW_UNFREE_OUT=$(nix-prefetch -f "$NIXPKGS_ROOT" -E "(p7zip.override { enableUnfree = true; }).src" --rev "v$NEW_VERSION" --output raw --print-path)
+# first line of raw output is the hash
+NEW_UNFREE_HASH="$(echo "$NEW_UNFREE_OUT" | sed -n 1p)"
+# second line of raw output is the src path
+NEW_UNFREE_SRC="$(echo "$NEW_UNFREE_OUT" | sed -n 2p)"
+# make sure to nuke the unfree src from the updater's machine
+# > the license requires that you agree to these use restrictions, or you must remove the software (source and binary) from your hard disks
+# https://fedoraproject.org/wiki/Licensing:Unrar
+nix-store --delete "$NEW_UNFREE_SRC"
+
+
+echo "updating version"
+sed -i "s/version = \"$OLD_VERSION\";/version = \"$NEW_VERSION\";/" "$DRV_DIR/default.nix"
+
+echo "updating free hash"
+sed -i "s@free = \"$OLD_FREE_HASH\";@free = \"$NEW_FREE_HASH\";@" "$DRV_DIR/default.nix"
+echo "updating unfree hash"
+sed -i "s@unfree = \"$OLD_UNFREE_HASH\";@unfree = \"$NEW_UNFREE_HASH\";@" "$DRV_DIR/default.nix"
+
+echo "done"
diff --git a/nixpkgs/pkgs/tools/archivers/pax/default.nix b/nixpkgs/pkgs/tools/archivers/pax/default.nix
new file mode 100644
index 000000000000..feacf73fe87b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/pax/default.nix
@@ -0,0 +1,35 @@
+{ lib, stdenv, fetchurl, utmp, musl-fts }:
+
+stdenv.mkDerivation rec {
+  pname = "pax";
+  version = "20201030";
+
+  src = fetchurl {
+    url = "http://www.mirbsd.org/MirOS/dist/mir/cpio/paxmirabilis-${version}.tgz";
+    sha256 = "1p18nxijh323f4i1s2pg7pcr0557xljl5avv8ll5s9nfr34r5j0w";
+  };
+
+  buildInputs = lib.optional stdenv.isDarwin utmp
+    ++ lib.optional stdenv.hostPlatform.isMusl musl-fts;
+
+  NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isMusl "-lfts";
+
+  buildPhase = ''
+    sh Build.sh -r -tpax
+  '';
+
+  installPhase = ''
+    install -Dm555 pax $out/bin/pax
+    ln -s $out/bin/pax $out/bin/paxcpio
+    ln -s $out/bin/pax $out/bin/paxtar
+    install -Dm444 mans/pax{,cpio,tar}.1 -t $out/share/man/man1/
+  '';
+
+  meta = with lib; {
+    description = "POSIX standard archive tool from MirBSD";
+    homepage = "https://www.mirbsd.org/pax.htm";
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ gebner ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/payload-dumper-go/default.nix b/nixpkgs/pkgs/tools/archivers/payload-dumper-go/default.nix
new file mode 100755
index 000000000000..bb1572e1ceb6
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/payload-dumper-go/default.nix
@@ -0,0 +1,30 @@
+{ lib
+, buildGoModule
+, fetchFromGitHub
+, xz
+}:
+
+buildGoModule rec {
+  pname = "payload-dumper-go";
+  version = "1.2.2";
+
+  src = fetchFromGitHub {
+    owner = "ssut";
+    repo = "payload-dumper-go";
+    rev = "refs/tags/${version}";
+    hash = "sha256-P20/Nd2YOW9A9/OkpavVRBAi/ueYp812zZvVLnwX67Y=";
+  };
+
+  vendorHash = "sha256-CqIZFMDN/kK9bT7b/32yQ9NJAQnkI8gZUMKa6MJCaec=";
+
+  buildInputs = [ xz ];
+
+  meta = with lib; {
+    description = "An android OTA payload dumper written in Go";
+    homepage = "https://github.com/ssut/payload-dumper-go";
+    changelog = "https://github.com/ssut/payload-dumper-go/releases/tag/${version}";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ aleksana ];
+    mainProgram = "payload-dumper-go";
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/payload_dumper/default.nix b/nixpkgs/pkgs/tools/archivers/payload_dumper/default.nix
new file mode 100644
index 000000000000..138f62739f41
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/payload_dumper/default.nix
@@ -0,0 +1,43 @@
+{ lib
+, stdenv
+, makeWrapper
+, python3
+, fetchFromGitHub
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "payload_dumper";
+  version = "unstable-2022-04-11";
+
+  src = fetchFromGitHub {
+    owner = "vm03";
+    repo = "payload_dumper";
+    rev = "c1eb5dbbc7bd88ac94635ae90ec22ccf92f89881";
+    sha256 = "1j1hbh5vqq33wq2b9gqvm1qs9nl0bmqklbnyyyhwkcha7zxn0aki";
+  };
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  buildInputs = with python3.pkgs; [ bsdiff4 protobuf ];
+
+  installPhase = ''
+    runHook preInstall
+
+    sitePackages=$out/${python3.sitePackages}/${finalAttrs.pname}
+
+    install -D ./payload_dumper.py $out/bin/payload_dumper
+    install -D ./update_metadata_pb2.py $sitePackages/update_metadata_pb2.py
+
+    wrapProgram $out/bin/payload_dumper \
+        --set PYTHONPATH "$sitePackages:$PYTHONPATH"
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    homepage = finalAttrs.src.meta.homepage;
+    description = "Android OTA payload dumper";
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ DamienCassou ];
+  };
+})
diff --git a/nixpkgs/pkgs/tools/archivers/pxattr/default.nix b/nixpkgs/pkgs/tools/archivers/pxattr/default.nix
new file mode 100644
index 000000000000..57eb7e6f87a1
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/pxattr/default.nix
@@ -0,0 +1,26 @@
+{ lib, stdenv, fetchurl, gcc }:
+
+stdenv.mkDerivation rec {
+  pname = "pxattr";
+  version = "2.1.0";
+
+  src = fetchurl {
+    url = "https://www.lesbonscomptes.com/pxattr/pxattr-${version}.tar.gz";
+    sha256 = "1dwcqc5z7gzma1zhis2md49bj2nq7m6jimh4zlx9szw6svisz56z";
+  };
+
+  buildInputs = [ gcc ];
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp pxattr $out/bin
+  '';
+
+  meta = {
+    homepage = "https://www.lesbonscomptes.com/pxattr/index.html";
+    description = "Provides a single interface to extended file attributes";
+    maintainers = [ lib.maintainers.vrthra ];
+    license = [ lib.licenses.mit ];
+    platforms = lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/quickbms/0002-disable-openssl.patch b/nixpkgs/pkgs/tools/archivers/quickbms/0002-disable-openssl.patch
new file mode 100644
index 000000000000..3d77f45e3f86
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/quickbms/0002-disable-openssl.patch
@@ -0,0 +1,10 @@
+--- src/Makefile	2023-05-25 18:16:56.000296653 +0900
++++ src/Makefile	2023-05-25 18:17:00.772272861 +0900
+@@ -23,7 +23,6 @@
+ EXTRA_TARGETS  = libs/amiga/amiga.s libs/powzix/*.cpp
+ CFLAGS += -msse2
+ endif
+-USE_OPENSSL	= 1
+ endif
+ 
+ # -liconv and -fPIC are necessary on Android
diff --git a/nixpkgs/pkgs/tools/archivers/quickbms/default.nix b/nixpkgs/pkgs/tools/archivers/quickbms/default.nix
new file mode 100644
index 000000000000..b8e1e9fc6f1c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/quickbms/default.nix
@@ -0,0 +1,43 @@
+{ stdenv
+, lib
+, fetchzip
+, fetchpatch
+, bzip2
+, lzo
+, openssl_1_1
+, opensslSupport ? false
+, zlib
+}:
+
+stdenv.mkDerivation rec {
+  version = "0.11.0";
+  pname = "quickbms";
+
+  src = fetchzip {
+    url = "https://aluigi.altervista.org/papers/quickbms-src-${version}.zip";
+    hash = "sha256-uQKTE36pLO8uhrX794utqaDGUeyqRz6zLCQFA7DYkNc=";
+  };
+
+  patches = [
+    # Fix errors on x86_64 and _rotl definition
+    (fetchpatch {
+      name = "0001-fix-compile.patch";
+      url = "https://aur.archlinux.org/cgit/aur.git/plain/fix-compile.patch?h=quickbms&id=a2e3e4638295d7cfe39513bfef9447fb23154a6b";
+      hash = "sha256-49fT/L4BNzMYnq1SXhFMgSDLybLkz6KSbgKmUpZZu08=";
+      stripLen = 1;
+    })
+  ] ++ lib.optional (!opensslSupport) ./0002-disable-openssl.patch;
+
+  buildInputs = [ bzip2 lzo zlib ]
+    ++ lib.optional (opensslSupport) openssl_1_1;
+
+  makeFlags = [ "PREFIX=$(out)" ];
+
+  meta = with lib; {
+    description = "Universal script based file extractor and reimporter";
+    homepage = "https://aluigi.altervista.org/quickbms.htm";
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/rar/default.nix b/nixpkgs/pkgs/tools/archivers/rar/default.nix
new file mode 100644
index 000000000000..a1c22835752b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/rar/default.nix
@@ -0,0 +1,68 @@
+{ lib, stdenv, fetchurl, autoPatchelfHook, installShellFiles }:
+
+let
+  version = "6.21";
+  downloadVersion = lib.replaceStrings [ "." ] [ "" ] version;
+  # Use `nix store prefetch-file <url>` to generate the hashes for the other systems
+  # TODO: create update script
+  srcUrl = {
+    i686-linux = {
+      url = "https://www.rarlab.com/rar/rarlinux-x32-${downloadVersion}.tar.gz";
+      hash = "sha256-mDeRmLTjF0ZLv4JoLrgI8YBFFulBSKfOPb6hrxDZIkU=";
+    };
+    x86_64-linux = {
+      url = "https://www.rarlab.com/rar/rarlinux-x64-${downloadVersion}.tar.gz";
+      hash = "sha256-3fr5aVkh/r6OfBEcZULJSZp5ydakJOLRPlgzMdlwGTM=";
+    };
+    aarch64-darwin = {
+      url = "https://www.rarlab.com/rar/rarmacos-arm-${downloadVersion}.tar.gz";
+      hash = "sha256-OR9HBlRteTzuyQ06tyXTSrFTBHFwmZ41kUfvgflogT4=";
+    };
+    x86_64-darwin = {
+      url = "https://www.rarlab.com/rar/rarmacos-x64-${downloadVersion}.tar.gz";
+      hash = "sha256-UN3gmEuIpCXwmw3/l+KdarAYLy1DxGoPAOB2bfJTGbw=";
+    };
+  }.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}");
+  manSrc = fetchurl {
+    url = "https://aur.archlinux.org/cgit/aur.git/plain/rar.1?h=rar&id=8e39a12e88d8a3b168c496c44c18d443c876dd10";
+    name = "rar.1";
+    hash = "sha256-93cSr9oAsi+xHUtMsUvICyHJe66vAImS2tLie7nt8Uw=";
+  };
+in
+stdenv.mkDerivation rec {
+  pname = "rar";
+  inherit version;
+
+  src = fetchurl srcUrl;
+
+  dontBuild = true;
+
+  buildInputs = lib.optionals stdenv.isLinux [ stdenv.cc.cc.lib ];
+
+  nativeBuildInputs = [ installShellFiles ]
+    ++ lib.optionals stdenv.isLinux [ autoPatchelfHook ];
+
+  installPhase = ''
+    runHook preInstall
+
+    install -Dm755 {rar,unrar} -t "$out/bin"
+    install -Dm755 default.sfx -t "$out/lib"
+    install -Dm644 {acknow.txt,license.txt} -t "$out/share/doc/rar"
+    install -Dm644 rarfiles.lst -t "$out/etc"
+
+    runHook postInstall
+  '';
+
+  postInstall = ''
+    installManPage ${manSrc}
+  '';
+
+  meta = with lib; {
+    description = "Utility for RAR archives";
+    homepage = "https://www.rarlab.com/";
+    sourceProvenance = with sourceTypes; [ binaryNativeCode ];
+    license = licenses.unfree;
+    maintainers = with maintainers; [ thiagokokada ];
+    platforms = with platforms; linux ++ darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/rpm2targz/default.nix b/nixpkgs/pkgs/tools/archivers/rpm2targz/default.nix
new file mode 100644
index 000000000000..1c4730c8de64
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/rpm2targz/default.nix
@@ -0,0 +1,50 @@
+{ bzip2
+, coreutils
+, cpio
+, fetchurl
+, gnutar
+, gzip
+, lib
+, stdenv
+, xz
+, zstd
+}:
+
+stdenv.mkDerivation rec {
+  pname = "rpm2targz";
+  version = "2021.03.16";
+
+  # git repo: https://gitweb.gentoo.org/proj/rpm2targz.git/
+  src = fetchurl {
+    url = "https://dev.gentoo.org/~vapier/dist/${pname}-${version}.tar.xz";
+    hash = "sha256-rcV+o9V2wWKznqSW2rA8xgnpQ02kpK4te6mYvLRC5vQ=";
+  };
+
+  postPatch = let
+    shdeps = [
+      bzip2
+      coreutils
+      cpio
+      gnutar
+      gzip
+      xz
+      zstd
+    ];
+  in ''
+    substituteInPlace rpm2targz --replace "=\"rpmoffset\"" "=\"$out/bin/rpmoffset\""
+    # rpm2targz relies on the executable name
+    # to guess what compressor it should use
+    # this is more reliable than wrapProgram
+    sed -i -e '2iexport PATH="${lib.makeBinPath shdeps}"' rpm2targz
+  '';
+
+  installFlags = [ "prefix=$(out)" ];
+
+  meta = with lib; {
+    description = "Convert a .rpm file to a .tar.gz archive";
+    homepage = "http://slackware.com/config/packages.php";
+    license = licenses.bsd1;
+    maintainers = with maintainers; [ zseri ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/rpmextract/default.nix b/nixpkgs/pkgs/tools/archivers/rpmextract/default.nix
new file mode 100644
index 000000000000..db768a5d14a2
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/rpmextract/default.nix
@@ -0,0 +1,23 @@
+{ lib, stdenv, rpm, cpio, substituteAll }:
+
+stdenv.mkDerivation {
+  name = "rpmextract";
+
+  buildCommand = ''
+    install -Dm755 $script $out/bin/rpmextract
+  '';
+
+  script = substituteAll {
+    src = ./rpmextract.sh;
+    isExecutable = true;
+    inherit rpm cpio;
+    inherit (stdenv) shell;
+  };
+
+  meta = with lib; {
+    description = "Script to extract RPM archives";
+    platforms = platforms.all;
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ abbradar ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/rpmextract/rpmextract.sh b/nixpkgs/pkgs/tools/archivers/rpmextract/rpmextract.sh
new file mode 100644
index 000000000000..6ebfa251955d
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/rpmextract/rpmextract.sh
@@ -0,0 +1,10 @@
+#!@shell@ -e
+
+if [ "$1" = "" ]; then
+  echo "usage: rpmextract package_name..." 1>&2
+  exit 1
+fi
+
+for i in "$@"; do
+  @rpm@/bin/rpm2cpio "$i" | @cpio@/bin/cpio -idv
+done
diff --git a/nixpkgs/pkgs/tools/archivers/runzip/default.nix b/nixpkgs/pkgs/tools/archivers/runzip/default.nix
new file mode 100644
index 000000000000..fddf90a5d23c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/runzip/default.nix
@@ -0,0 +1,23 @@
+{ lib, stdenv, fetchFromGitHub, libzip, libiconv, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  version = "1.4";
+  pname = "runzip";
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [ libiconv libzip ];
+
+  src = fetchFromGitHub {
+    owner = "vlm";
+    repo = "zip-fix-filename-encoding";
+    rev = "v${version}";
+    sha256 = "0l5zbb5hswxczigvyal877j0aiq3fc01j3gv88bvy7ikyvw3lc07";
+  };
+
+  meta = {
+    description = "A tool to convert filename encoding inside a ZIP archive";
+    license = lib.licenses.bsd2;
+    maintainers = [ lib.maintainers.raskin ];
+    platforms = lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/s-tar/default.nix b/nixpkgs/pkgs/tools/archivers/s-tar/default.nix
new file mode 100644
index 000000000000..89830322267c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/s-tar/default.nix
@@ -0,0 +1,35 @@
+{ lib, stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  pname = "s-tar";
+  version = "1.6";
+  src = fetchurl {
+    url = "mirror://sourceforge/s-tar/star-${version}.tar.bz2";
+    sha256 = "0xpp8gf0ghwdgncdwx17fpadxislwrj48gcm42851hz6p8p6c60v";
+  };
+
+  preConfigure = "rm configure";
+  preBuild = "sed 's_/bin/__g' -i RULES/*";
+  makeFlags = [ "GMAKE_NOWARN=true" ];
+  installFlags = [ "DESTDIR=$(out)" "INS_BASE=/" ];
+  postInstall = ''
+    find $out/bin -type l -delete
+    rm -r $out/etc $out/include $out/sbin
+  '';
+
+  meta = {
+    description = "A very fast tar like tape archiver with improved functionality";
+    longDescription = ''
+      Star archives and extracts multiple files to and from a single file called a tarfile.
+      A tarfile is usually a magnetic tape, but it can be any file.
+      In all cases, appearance of a directory name refers to the files and (recursively) sub-directories of that directory.
+      Star's actions are controlled by the mandatory command flags from the list below.
+      The way star acts may be modified by additional options.
+      Note that unpacking tar archives may be a security risk because star may overwrite existing files.
+    '';
+    homepage = "https://cdrtools.sourceforge.net/private/star.html";
+    license = lib.licenses.cddl;
+    maintainers = [ lib.maintainers.wucke13 ];
+    platforms = [ "x86_64-linux" ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/sharutils/default.nix b/nixpkgs/pkgs/tools/archivers/sharutils/default.nix
new file mode 100644
index 000000000000..c504ed8f16e1
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/sharutils/default.nix
@@ -0,0 +1,86 @@
+{ lib, stdenv, fetchurl, fetchpatch, gettext, coreutils }:
+
+stdenv.mkDerivation rec {
+  pname = "sharutils";
+  version = "4.15.2";
+
+  src = fetchurl {
+    url = "mirror://gnu/sharutils/sharutils-${version}.tar.xz";
+    sha256 = "16isapn8f39lnffc3dp4dan05b7x6mnc76v6q5nn8ysxvvvwy19b";
+  };
+
+  hardeningDisable = [ "format" ];
+
+  # GNU Gettext is needed on non-GNU platforms.
+  buildInputs = [ coreutils gettext ];
+
+  # These tests try to hit /etc/passwd to find out your username if pass in a submitter
+  # name on the command line. Since we block access to /etc/passwd on the Darwin sandbox
+  # that cause shar to just segfault. It isn't a problem on Linux because their sandbox
+  # remaps /etc/passwd to a trivial file, but we can't do that on Darwin so I do this
+  # instead. In this case, I pass in the very imaginative "submitter" as the submitter name
+
+  patches = [
+    # CVE-2018-1000097
+    (fetchurl {
+      url = "https://sources.debian.org/data/main/s/sharutils/1:4.15.2-2+deb9u1/debian/patches/01-fix-heap-buffer-overflow-cve-2018-1000097.patch";
+      sha256 = "19g0sxc8g79aj5gd5idz5409311253jf2q8wqkasf0handdvsbxx";
+    })
+    (fetchurl {
+      url = "https://sources.debian.org/data/main/s/sharutils/1:4.15.2-4/debian/patches/02-fix-ftbfs-with-glibc-2.28.patch";
+      sha256 = "15kpjqnfs98n6irmkh8pw7masr08xala7gx024agv7zv14722vkc";
+    })
+
+    # pending upstream build fix against -fno-common compilers like >=gcc-10
+    # Taken from https://lists.gnu.org/archive/html/bug-gnu-utils/2020-01/msg00002.html
+    (fetchpatch {
+      name = "sharutils-4.15.2-Fix-building-with-GCC-10.patch";
+      url = "https://lists.gnu.org/archive/html/bug-gnu-utils/2020-01/txtDL8i6V6mUU.txt";
+      sha256 = "0kfch1vm45lg237hr6fdv4b2lh5b1933k0fn8yj91gqm58svskvl";
+    })
+    (fetchpatch {
+      name = "sharutils-4.15.2-Do-not-include-lib-md5.c-into-src-shar.c.patch";
+      url = "https://lists.gnu.org/archive/html/bug-gnu-utils/2020-01/txt5Z_KZup0yN.txt";
+      sha256 = "0an8vfy3qj6sss9w0i4j8ilf7g5mbc7y13l644jy5bcm9przcjbd";
+    })
+  ];
+
+  postPatch = let
+      # This evaluates to a string containing:
+      #
+      #     substituteInPlace tests/shar-2 --replace '${SHAR}' '${SHAR} -s submitter'
+      #     substituteInPlace tests/shar-2 --replace '${SHAR}' '${SHAR} -s submitter'
+      shar_sub = "\${SHAR}";
+    in ''
+      substituteInPlace tests/shar-1 --replace '${shar_sub}' '${shar_sub} -s submitter'
+      substituteInPlace tests/shar-2 --replace '${shar_sub}' '${shar_sub} -s submitter'
+
+      substituteInPlace intl/Makefile.in --replace "AR = ar" ""
+    '';
+
+  doCheck = true;
+
+  meta = with lib; {
+    description = "Tools for remote synchronization and `shell archives'";
+    longDescription =
+      '' GNU shar makes so-called shell archives out of many files, preparing
+         them for transmission by electronic mail services.  A shell archive
+         is a collection of files that can be unpacked by /bin/sh.  A wide
+         range of features provide extensive flexibility in manufacturing
+         shars and in specifying shar smartness.  For example, shar may
+         compress files, uuencode binary files, split long files and
+         construct multi-part mailings, ensure correct unsharing order, and
+         provide simplistic checksums.
+
+         GNU unshar scans a set of mail messages looking for the start of
+         shell archives.  It will automatically strip off the mail headers
+         and other introductory text.  The archive bodies are then unpacked
+         by a copy of the shell. unshar may also process files containing
+         concatenated shell archives.
+      '';
+    homepage = "https://www.gnu.org/software/sharutils/";
+    license = licenses.gpl3Plus;
+    maintainers = [];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/snzip/default.nix b/nixpkgs/pkgs/tools/archivers/snzip/default.nix
new file mode 100644
index 000000000000..c759a7ac07f1
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/snzip/default.nix
@@ -0,0 +1,31 @@
+{ lib, stdenv, fetchFromGitHub
+, autoreconfHook
+, pkg-config
+, snappy
+}:
+
+stdenv.mkDerivation rec {
+  pname = "snzip";
+  version = "1.0.5";
+
+  src = fetchFromGitHub {
+    owner = "kubo";
+    repo = "snzip";
+    rev = "v${version}";
+    hash = "sha256-trxCGVNw2MugE7kmth62Qrp7JZcHeP1gdTZk32c3hFg=";
+  };
+
+  buildInputs = [ snappy ];
+  # We don't use a release tarball so we don't have a `./configure` script to
+  # run. That's why we generate it.
+  nativeBuildInputs = [ autoreconfHook pkg-config ];
+
+  meta = with lib; {
+    description = "A compression/decompression tool based on snappy";
+    homepage = "https://github.com/kubo/snzip";
+    maintainers = with maintainers; [ doronbehar ];
+    license = licenses.bsd2;
+    platforms = platforms.linux;
+  };
+}
+
diff --git a/nixpkgs/pkgs/tools/archivers/tarlz/default.nix b/nixpkgs/pkgs/tools/archivers/tarlz/default.nix
new file mode 100644
index 000000000000..7f41a05a9a88
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/tarlz/default.nix
@@ -0,0 +1,28 @@
+{ lib, stdenv, fetchurl, lzip, lzlib, texinfo }:
+
+stdenv.mkDerivation rec {
+  pname = "tarlz";
+  version = "0.22";
+  outputs = [ "out" "man" "info" ];
+
+  nativeBuildInputs = [ lzip texinfo ];
+  buildInputs = [ lzlib ];
+
+  src = fetchurl {
+    url = "mirror://savannah/lzip/${pname}/${pname}-${version}.tar.lz";
+    sha256 = "sha256-/M9yJvoktV0ybKsT926jSb7ERsWo33GkbTQwmaBQkdw=";
+  };
+
+  enableParallelBuilding = true;
+  makeFlags = [ "CXX:=$(CXX)" ];
+  doCheck = !stdenv.isDarwin;
+
+  meta = with lib; {
+    homepage = "https://www.nongnu.org/lzip/${pname}.html";
+    description =
+      "Massively parallel combined implementation of the tar archiver and the lzip compressor";
+    license = licenses.gpl2Plus;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ ehmry ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/torrent7z/default.nix b/nixpkgs/pkgs/tools/archivers/torrent7z/default.nix
new file mode 100644
index 000000000000..74eaa4409f75
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/torrent7z/default.nix
@@ -0,0 +1,53 @@
+{ lib, stdenv, fetchFromGitHub, fetchpatch, ncurses }:
+
+stdenv.mkDerivation rec {
+  pname = "torrent7z";
+  version = "1.3";
+
+  src = fetchFromGitHub {
+    owner = "BubblesInTheTub";
+    repo = pname;
+    rev = version;
+    sha256 = "Y2tr0+z9uij4Ifi6FfWRN24BwcDXUZKVLkLtKUiVjU4=";
+  };
+
+  patches = [
+    (fetchpatch {
+      name = "fix-gcc10-compilation.patch"; # Fix compilation on GCC 10. This patch is included on the latest commit
+      url =
+        "https://github.com/paulyc/torrent7z/commit/5958f42a364c430b3ed4ac68911bbbea1f967fc4.patch";
+      sha256 = "vJOv1sG9XwTvvxQiWew0H5ALoUb9wIAouzTsTvKHuPI=";
+    })
+  ];
+
+  buildInputs = [ ncurses ];
+
+  hardeningDisable = [ "format" ];
+
+  postPatch = ''
+    # Remove non-free RAR source code
+    # (see DOC/License.txt, https://fedoraproject.org/wiki/Licensing:Unrar)
+    rm -r linux_src/p7zip_4.65/CPP/7zip/Compress/Rar*
+    find . -name makefile'*' -exec sed -i '/Rar/d' {} +
+  '';
+
+  preConfigure = ''
+    mkdir linux_src/p7zip_4.65/bin
+    cd linux_src/p7zip_4.65/CPP/7zip/Bundles/Alone
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp ../../../../bin/t7z $out/bin
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/BubblesInTheTub/torrent7z";
+    description = "A fork of torrent7z, viz a derivative of 7zip that produces invariant .7z archives for torrenting";
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ cirno-999 ];
+    mainProgram = "t7z";
+    # RAR code is under non-free UnRAR license, but we remove it
+    license = licenses.gpl3Only;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/unar/default.nix b/nixpkgs/pkgs/tools/archivers/unar/default.nix
new file mode 100644
index 000000000000..550e14355992
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unar/default.nix
@@ -0,0 +1,98 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, installShellFiles
+, gnustep
+, bzip2
+, zlib
+, icu
+, openssl
+, wavpack
+, xcbuildHook
+, Foundation
+, AppKit
+}:
+
+stdenv.mkDerivation rec {
+  pname = "unar";
+  version = "1.10.7";
+
+  src = fetchFromGitHub {
+    owner = "MacPaw";
+    # the unar repo contains a shallow clone of both XADMaster and universal-detector
+    repo = "unar";
+    rev = "v${version}";
+    sha256 = "0p846q1l66k3rnd512sncp26zpv411b8ahi145sghfcsz9w8abc4";
+  };
+
+  postPatch =
+    if stdenv.isDarwin then ''
+      substituteInPlace "./XADMaster.xcodeproj/project.pbxproj" \
+        --replace "libstdc++.6.dylib" "libc++.1.dylib"
+    '' else ''
+      for f in Makefile.linux ../UniversalDetector/Makefile.linux ; do
+        substituteInPlace $f \
+          --replace "= gcc" "=${stdenv.cc.targetPrefix}cc" \
+          --replace "= g++" "=${stdenv.cc.targetPrefix}c++" \
+          --replace "-DGNU_RUNTIME=1" "" \
+          --replace "-fgnu-runtime" "-fobjc-runtime=gnustep-2.0"
+      done
+
+      # we need to build inside this directory as well, so we have to make it writeable
+      chmod +w ../UniversalDetector -R
+    '';
+
+  buildInputs = [ bzip2 icu openssl wavpack zlib ] ++
+    lib.optionals stdenv.isLinux [ gnustep.base ] ++
+    lib.optionals stdenv.isDarwin [ Foundation AppKit ];
+
+  nativeBuildInputs = [ installShellFiles ] ++
+    lib.optionals stdenv.isLinux [ gnustep.make ] ++
+    lib.optionals stdenv.isDarwin [ xcbuildHook ];
+
+  xcbuildFlags = lib.optionals stdenv.isDarwin [
+    "-target unar"
+    "-target lsar"
+    "-configuration Release"
+    "MACOSX_DEPLOYMENT_TARGET=10.12"
+    # Fix "ld: file not found: /nix/store/*-clang-7.1.0/lib/arc/libarclite_macosx." error
+    # Disabling ARC may leak memory, however since this program is generally not used for
+    # long periods of time, it shouldn't be an issue
+    "CLANG_LINK_OBJC_RUNTIME=NO"
+  ];
+
+  makefile = lib.optionalString (!stdenv.isDarwin) "Makefile.linux";
+
+  enableParallelBuilding = true;
+
+  dontConfigure = true;
+
+  sourceRoot = "./source/XADMaster";
+
+  installPhase = ''
+    runHook preInstall
+
+    install -Dm555 -t $out/bin ${lib.optionalString stdenv.isDarwin "Products/Release/"}{lsar,unar}
+    for f in lsar unar; do
+      installManPage ./Extra/$f.?
+      installShellCompletion --bash --name $f ./Extra/$f.bash_completion
+    done
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    homepage = "https://theunarchiver.com";
+    description = "An archive unpacker program";
+    longDescription = ''
+      The Unarchiver is an archive unpacker program with support for the popular
+      zip, RAR, 7z, tar, gzip, bzip2, LZMA, XZ, CAB, MSI, NSIS, EXE, ISO, BIN,
+      and split file formats, as well as the old Stuffit, Stuffit X, DiskDouble,
+      Compact Pro, Packit, cpio, compress (.Z), ARJ, ARC, PAK, ACE, ZOO, LZH,
+      ADF, DMS, LZX, PowerPacker, LBR, Squeeze, Crunch, and other old formats.
+    '';
+    license = licenses.lgpl21Plus;
+    maintainers = with maintainers; [ peterhoeg thiagokokada ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/undmg/default.nix b/nixpkgs/pkgs/tools/archivers/undmg/default.nix
new file mode 100644
index 000000000000..0bbf725d191b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/undmg/default.nix
@@ -0,0 +1,29 @@
+{ lib, stdenv, fetchFromGitHub, zlib, bzip2, lzfse, pkg-config }:
+
+stdenv.mkDerivation rec {
+  version = "1.1.0";
+  pname = "undmg";
+
+  src = fetchFromGitHub {
+    owner = "matthewbauer";
+    repo = "undmg";
+    rev = "v${version}";
+    sha256 = "0rb4h89jrl04vwf6p679ipa4mp95hzmc1ca11wqbanv3xd1kcpxm";
+  };
+
+  nativeBuildInputs = [ pkg-config ];
+
+  buildInputs = [ zlib bzip2 lzfse ];
+
+  setupHook = ./setup-hook.sh;
+
+  makeFlags = [ "PREFIX=$(out)" ];
+
+  meta = with lib; {
+    homepage = "https://github.com/matthewbauer/undmg";
+    description = "Extract a DMG file";
+    license = licenses.gpl3;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ matthewbauer lnl7 ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/undmg/setup-hook.sh b/nixpkgs/pkgs/tools/archivers/undmg/setup-hook.sh
new file mode 100644
index 000000000000..bc7ed76107ef
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/undmg/setup-hook.sh
@@ -0,0 +1,5 @@
+unpackCmdHooks+=(_tryUnpackDmg)
+_tryUnpackDmg() {
+    if ! [[ "$curSrc" =~ \.dmg$ ]]; then return 1; fi
+    undmg "$curSrc"
+}
diff --git a/nixpkgs/pkgs/tools/archivers/unp/default.nix b/nixpkgs/pkgs/tools/archivers/unp/default.nix
new file mode 100644
index 000000000000..aeb0fb91c989
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unp/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, lib, fetchurl, makeWrapper, perl
+, unzip, gzip, file
+# extractors which are added to unp’s PATH
+, extraBackends ? []
+}:
+
+let
+  runtime_bins =  [ file unzip gzip ] ++ extraBackends;
+
+in stdenv.mkDerivation {
+  pname = "unp";
+  version = "2.0-pre9";
+  nativeBuildInputs = [ makeWrapper ];
+  buildInputs = [ perl ];
+
+  src = fetchurl {
+    url = "mirror://debian/pool/main/u/unp/unp_2.0~pre9.tar.xz";
+    sha256 = "1lp5vi9x1qi3b21nzv0yqqacj6p74qkl5zryzwq30rjkyvahjya1";
+    name = "unp_2.0_pre9.tar.xz";
+  };
+
+  dontConfigure = true;
+  buildPhase = "true";
+  installPhase = ''
+  mkdir -p $out/bin
+  mkdir -p $out/share/man/man1
+  install ./unp $out/bin/unp
+  install ./ucat $out/bin/ucat
+  cp debian/unp.1 $out/share/man/man1
+
+  wrapProgram $out/bin/unp \
+    --prefix PATH : ${lib.makeBinPath runtime_bins}
+  wrapProgram $out/bin/ucat \
+    --prefix PATH : ${lib.makeBinPath runtime_bins}
+  '';
+
+  meta = with lib; {
+    description = "Command line tool for unpacking archives easily";
+    homepage = "https://packages.qa.debian.org/u/unp.html";
+    license = with licenses; [ gpl2 ];
+    maintainers = [ maintainers.timor ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/unrar-wrapper/default.nix b/nixpkgs/pkgs/tools/archivers/unrar-wrapper/default.nix
new file mode 100644
index 000000000000..7452969cbdb4
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unrar-wrapper/default.nix
@@ -0,0 +1,36 @@
+{ lib, buildPythonApplication, fetchFromGitHub, unar }:
+
+buildPythonApplication rec {
+  pname = "unrar-wrapper";
+  version = "1.0.0";
+
+  src = fetchFromGitHub {
+    owner = "openSUSE";
+    repo = "unrar_wrapper";
+    rev = "unrar_wrapper-${version}";
+    sha256 = "sha256-HjrUif8MrbtLjRQMAPZ/Y2o43rGSDj0HHY4fZQfKz5w=";
+  };
+
+  makeWrapperArgs = [
+    "--prefix" "PATH" ":" "${lib.makeBinPath [ unar ]}"
+  ];
+
+  postFixup = ''
+    ln -s $out/bin/unrar_wrapper $out/bin/unrar
+    rm -rf $out/nix-support/propagated-build-inputs
+  '';
+
+  setupHook = ./setup-hook.sh;
+
+  meta = with lib; {
+    homepage = "https://github.com/openSUSE/unrar_wrapper";
+    description = "Backwards compatibility between unar and unrar";
+    longDescription = ''
+      unrar_wrapper is a wrapper python script that transforms the basic UnRAR commands
+      to unar and lsar calls in order to provide a backwards compatibility.
+    '';
+    license = licenses.gpl3Only;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ artturin ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/unrar-wrapper/setup-hook.sh b/nixpkgs/pkgs/tools/archivers/unrar-wrapper/setup-hook.sh
new file mode 100644
index 000000000000..41d6a5cd217b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unrar-wrapper/setup-hook.sh
@@ -0,0 +1,5 @@
+unpackCmdHooks+=(_tryUnrar)
+_tryUnrar() {
+    if ! [[ "$curSrc" =~ \.rar$ ]]; then return 1; fi
+    unrar x "$curSrc" >/dev/null
+}
diff --git a/nixpkgs/pkgs/tools/archivers/unrar/default.nix b/nixpkgs/pkgs/tools/archivers/unrar/default.nix
new file mode 100644
index 000000000000..74f1bcfe9b8b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unrar/default.nix
@@ -0,0 +1,54 @@
+{lib, stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  pname = "unrar";
+  version = "6.2.5";
+
+  src = fetchurl {
+    url = "https://www.rarlab.com/rar/unrarsrc-${version}.tar.gz";
+    hash = "sha256-mjl0QQ0dNA45mN0qb5j6776DjK1VYmbnFK37Doz5N3w=";
+  };
+
+  postPatch = ''
+    substituteInPlace makefile \
+      --replace "CXX=" "#CXX=" \
+      --replace "STRIP=" "#STRIP=" \
+      --replace "AR=" "#AR="
+  '';
+
+  buildPhase = ''
+    # `make {unrar,lib}` call `make clean` implicitly
+    # move build results to another dir to avoid deleting them
+    mkdir -p bin
+
+    make unrar
+    mv unrar bin
+
+    make lib
+    mv libunrar.so bin
+  '';
+
+  outputs = [ "out" "dev" ];
+
+  installPhase = ''
+    install -Dt "$out/bin" bin/unrar
+
+    mkdir -p $out/share/doc/unrar
+    cp acknow.txt license.txt \
+        $out/share/doc/unrar
+
+    install -Dm755 bin/libunrar.so $out/lib/libunrar.so
+
+    install -Dt $dev/include/unrar/ *.hpp
+  '';
+
+  setupHook = ./setup-hook.sh;
+
+  meta = with lib; {
+    description = "Utility for RAR archives";
+    homepage = "https://www.rarlab.com/";
+    license = licenses.unfreeRedistributable;
+    maintainers = [ maintainers.ehmry ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/unrar/setup-hook.sh b/nixpkgs/pkgs/tools/archivers/unrar/setup-hook.sh
new file mode 100644
index 000000000000..41d6a5cd217b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unrar/setup-hook.sh
@@ -0,0 +1,5 @@
+unpackCmdHooks+=(_tryUnrar)
+_tryUnrar() {
+    if ! [[ "$curSrc" =~ \.rar$ ]]; then return 1; fi
+    unrar x "$curSrc" >/dev/null
+}
diff --git a/nixpkgs/pkgs/tools/archivers/unshield/default.nix b/nixpkgs/pkgs/tools/archivers/unshield/default.nix
new file mode 100644
index 000000000000..b3d023df59b7
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unshield/default.nix
@@ -0,0 +1,23 @@
+{ lib, stdenv, fetchFromGitHub, cmake, zlib, openssl }:
+
+stdenv.mkDerivation rec {
+  pname = "unshield";
+  version = "1.5.1";
+
+  src = fetchFromGitHub {
+    owner = "twogood";
+    repo = "unshield";
+    rev = version;
+    sha256 = "1p2inn93svm83kr5p0j1al0rx47f1zykmagxsblgy04gi942iza3";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ zlib openssl ];
+
+  meta = with lib; {
+    description = "Tool and library to extract CAB files from InstallShield installers";
+    homepage = "https://github.com/twogood/unshield";
+    license = licenses.mit;
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/unzip/CVE-2014-8139.diff b/nixpkgs/pkgs/tools/archivers/unzip/CVE-2014-8139.diff
new file mode 100644
index 000000000000..3bcc21c7c0d8
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unzip/CVE-2014-8139.diff
@@ -0,0 +1,47 @@
+From RedHat: https://bugzilla.redhat.com/attachment.cgi?id=971984&action=diff&context=patch&collapsed=&headers=1&format=raw
+
+--- unzip60/extract.c	2010-04-03 14:41:55 -0500
++++ unzip60/extract.c	2014-12-03 15:33:35 -0600
+@@ -1,5 +1,5 @@ 
+ /*
+-  Copyright (c) 1990-2009 Info-ZIP.  All rights reserved.
++  Copyright (c) 1990-2014 Info-ZIP.  All rights reserved.
+ 
+   See the accompanying file LICENSE, version 2009-Jan-02 or later
+   (the contents of which are also included in unzip.h) for terms of use.
+@@ -298,6 +298,8 @@ 
+ #ifndef SFX
+    static ZCONST char Far InconsistEFlength[] = "bad extra-field entry:\n \
+      EF block length (%u bytes) exceeds remaining EF data (%u bytes)\n";
++   static ZCONST char Far TooSmallEFlength[] = "bad extra-field entry:\n \
++     EF block length (%u bytes) invalid (< %d)\n";
+    static ZCONST char Far InvalidComprDataEAs[] =
+      " invalid compressed data for EAs\n";
+ #  if (defined(WIN32) && defined(NTSD_EAS))
+@@ -2023,7 +2025,8 @@ 
+         ebID = makeword(ef);
+         ebLen = (unsigned)makeword(ef+EB_LEN);
+ 
+-        if (ebLen > (ef_len - EB_HEADSIZE)) {
++        if (ebLen > (ef_len - EB_HEADSIZE))
++        {
+            /* Discovered some extra field inconsistency! */
+             if (uO.qflag)
+                 Info(slide, 1, ((char *)slide, "%-22s ",
+@@ -2032,6 +2035,16 @@ 
+               ebLen, (ef_len - EB_HEADSIZE)));
+             return PK_ERR;
+         }
++        else if (ebLen < EB_HEADSIZE)
++        {
++            /* Extra block length smaller than header length. */
++            if (uO.qflag)
++                Info(slide, 1, ((char *)slide, "%-22s ",
++                  FnFilter1(G.filename)));
++            Info(slide, 1, ((char *)slide, LoadFarString(TooSmallEFlength),
++              ebLen, EB_HEADSIZE));
++            return PK_ERR;
++        }
+ 
+         switch (ebID) {
+             case EF_OS2:
diff --git a/nixpkgs/pkgs/tools/archivers/unzip/CVE-2014-8140.diff b/nixpkgs/pkgs/tools/archivers/unzip/CVE-2014-8140.diff
new file mode 100644
index 000000000000..81b96b8df7db
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unzip/CVE-2014-8140.diff
@@ -0,0 +1,26 @@
+From RedHat: https://bugzilla.redhat.com/attachment.cgi?id=969621&action=diff
+(unzip60/ path prefix added)
+
+--- unzip60/extract.c	2009-03-14 02:32:52.000000000 +0100
++++ unzip60/extract.c	2014-12-05 22:43:13.000000000 +0100
+@@ -2221,10 +2234,17 @@ static int test_compr_eb(__G__ eb, eb_si
+     if (compr_offset < 4)                /* field is not compressed: */
+         return PK_OK;                    /* do nothing and signal OK */
+ 
++    /* Return no/bad-data error status if any problem is found:
++     *    1. eb_size is too small to hold the uncompressed size
++     *       (eb_ucsize).  (Else extract eb_ucsize.)
++     *    2. eb_ucsize is zero (invalid).  2014-12-04 SMS.
++     *    3. eb_ucsize is positive, but eb_size is too small to hold
++     *       the compressed data header.
++     */
+     if ((eb_size < (EB_UCSIZE_P + 4)) ||
+-        ((eb_ucsize = makelong(eb+(EB_HEADSIZE+EB_UCSIZE_P))) > 0L &&
+-         eb_size <= (compr_offset + EB_CMPRHEADLEN)))
+-        return IZ_EF_TRUNC;               /* no compressed data! */
++     ((eb_ucsize = makelong( eb+ (EB_HEADSIZE+ EB_UCSIZE_P))) == 0L) ||
++     ((eb_ucsize > 0L) && (eb_size <= (compr_offset + EB_CMPRHEADLEN))))
++        return IZ_EF_TRUNC;             /* no/bad compressed data! */
+ 
+     if (
+ #ifdef INT_16BIT
diff --git a/nixpkgs/pkgs/tools/archivers/unzip/CVE-2014-8141.diff b/nixpkgs/pkgs/tools/archivers/unzip/CVE-2014-8141.diff
new file mode 100644
index 000000000000..11007195b1ff
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unzip/CVE-2014-8141.diff
@@ -0,0 +1,136 @@
+From RedHat: https://bugzilla.redhat.com/attachment.cgi?id=969625&action=diff
+(unzip60/ path prefix added)
+
+--- unzip60/process.c	2009-03-06 02:25:10.000000000 +0100
++++ unzip60/process.c	2014-12-05 22:42:39.000000000 +0100
+@@ -1,5 +1,5 @@ 
+ /*
+-  Copyright (c) 1990-2009 Info-ZIP.  All rights reserved.
++  Copyright (c) 1990-2014 Info-ZIP.  All rights reserved.
+ 
+   See the accompanying file LICENSE, version 2009-Jan-02 or later
+   (the contents of which are also included in unzip.h) for terms of use.
+@@ -1888,48 +1888,82 @@ int getZip64Data(__G__ ef_buf, ef_len)
+     and a 4-byte version of disk start number.
+     Sets both local header and central header fields.  Not terribly clever,
+     but it means that this procedure is only called in one place.
++
++    2014-12-05 SMS.
++    Added checks to ensure that enough data are available before calling
++    makeint64() or makelong().  Replaced various sizeof() values with
++    simple ("4" or "8") constants.  (The Zip64 structures do not depend
++    on our variable sizes.)  Error handling is crude, but we should now
++    stay within the buffer.
+   ---------------------------------------------------------------------------*/
+ 
++#define Z64FLGS 0xffff
++#define Z64FLGL 0xffffffff
++
+     if (ef_len == 0 || ef_buf == NULL)
+         return PK_COOL;
+ 
+     Trace((stderr,"\ngetZip64Data: scanning extra field of length %u\n",
+       ef_len));
+ 
+-    while (ef_len >= EB_HEADSIZE) {
++    while (ef_len >= EB_HEADSIZE)
++    {
+         eb_id = makeword(EB_ID + ef_buf);
+         eb_len = makeword(EB_LEN + ef_buf);
+ 
+-        if (eb_len > (ef_len - EB_HEADSIZE)) {
+-            /* discovered some extra field inconsistency! */
++        if (eb_len > (ef_len - EB_HEADSIZE))
++        {
++            /* Extra block length exceeds remaining extra field length. */
+             Trace((stderr,
+               "getZip64Data: block length %u > rest ef_size %u\n", eb_len,
+               ef_len - EB_HEADSIZE));
+             break;
+         }
+-        if (eb_id == EF_PKSZ64) {
+-
++        if (eb_id == EF_PKSZ64)
++        {
+           int offset = EB_HEADSIZE;
+ 
+-          if (G.crec.ucsize == 0xffffffff || G.lrec.ucsize == 0xffffffff){
+-            G.lrec.ucsize = G.crec.ucsize = makeint64(offset + ef_buf);
+-            offset += sizeof(G.crec.ucsize);
++          if ((G.crec.ucsize == Z64FLGL) || (G.lrec.ucsize == Z64FLGL))
++          {
++            if (offset+ 8 > ef_len)
++              return PK_ERR;
++
++            G.crec.ucsize = G.lrec.ucsize = makeint64(offset + ef_buf);
++            offset += 8;
+           }
+-          if (G.crec.csize == 0xffffffff || G.lrec.csize == 0xffffffff){
+-            G.csize = G.lrec.csize = G.crec.csize = makeint64(offset + ef_buf);
+-            offset += sizeof(G.crec.csize);
++
++          if ((G.crec.csize == Z64FLGL) || (G.lrec.csize == Z64FLGL))
++          {
++            if (offset+ 8 > ef_len)
++              return PK_ERR;
++
++            G.csize = G.crec.csize = G.lrec.csize = makeint64(offset + ef_buf);
++            offset += 8;
+           }
+-          if (G.crec.relative_offset_local_header == 0xffffffff){
++
++          if (G.crec.relative_offset_local_header == Z64FLGL)
++          {
++            if (offset+ 8 > ef_len)
++              return PK_ERR;
++
+             G.crec.relative_offset_local_header = makeint64(offset + ef_buf);
+-            offset += sizeof(G.crec.relative_offset_local_header);
++            offset += 8;
+           }
+-          if (G.crec.disk_number_start == 0xffff){
++
++          if (G.crec.disk_number_start == Z64FLGS)
++          {
++            if (offset+ 4 > ef_len)
++              return PK_ERR;
++
+             G.crec.disk_number_start = (zuvl_t)makelong(offset + ef_buf);
+-            offset += sizeof(G.crec.disk_number_start);
++            offset += 4;
+           }
++#if 0
++          break;                /* Expect only one EF_PKSZ64 block. */
++#endif /* 0 */
+         }
+ 
+-        /* Skip this extra field block */
++        /* Skip this extra field block. */
+         ef_buf += (eb_len + EB_HEADSIZE);
+         ef_len -= (eb_len + EB_HEADSIZE);
+     }
+--- unzip60/fileio.c	2009-04-20 02:03:44.000000000 +0200
++++ unzip60/fileio.c	2014-12-05 22:44:16.000000000 +0100
+@@ -176,6 +176,8 @@ static ZCONST char Far FilenameTooLongTr
+ #endif
+ static ZCONST char Far ExtraFieldTooLong[] =
+   "warning:  extra field too long (%d).  Ignoring...\n";
++static ZCONST char Far ExtraFieldCorrupt[] =
++  "warning:  extra field (type: 0x%04x) corrupt.  Continuing...\n";
+ 
+ #ifdef WINDLL
+    static ZCONST char Far DiskFullQuery[] =
+@@ -2295,7 +2297,12 @@ int do_string(__G__ length, option)   /*
+             if (readbuf(__G__ (char *)G.extra_field, length) == 0)
+                 return PK_EOF;
+             /* Looks like here is where extra fields are read */
+-            getZip64Data(__G__ G.extra_field, length);
++            if (getZip64Data(__G__ G.extra_field, length) != PK_COOL)
++            {
++                Info(slide, 0x401, ((char *)slide,
++                 LoadFarString( ExtraFieldCorrupt), EF_PKSZ64));
++                error = PK_WARN;
++            }
+ #ifdef UNICODE_SUPPORT
+             G.unipath_filename = NULL;
+             if (G.UzO.U_flag < 2) {
diff --git a/nixpkgs/pkgs/tools/archivers/unzip/CVE-2014-9636.diff b/nixpkgs/pkgs/tools/archivers/unzip/CVE-2014-9636.diff
new file mode 100644
index 000000000000..d4c7f752975e
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unzip/CVE-2014-9636.diff
@@ -0,0 +1,42 @@
+From 190040ebfcf5395a6ccedede2cc9343d34f0a108 Mon Sep 17 00:00:00 2001
+From: mancha <mancha1 AT zoho DOT com>
+Date: Wed, 11 Feb 2015
+Subject: Info-ZIP UnZip buffer overflow
+
+By carefully crafting a corrupt ZIP archive with "extra fields" that
+purport to have compressed blocks larger than the corresponding
+uncompressed blocks in STORED no-compression mode, an attacker can
+trigger a heap overflow that can result in application crash or
+possibly have other unspecified impact.
+
+This patch ensures that when extra fields use STORED mode, the
+"compressed" and uncompressed block sizes match.
+
+---
+ extract.c |    8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/extract.c
++++ b/extract.c
+@@ -2217,6 +2217,7 @@ static int test_compr_eb(__G__ eb, eb_si
+     ulg eb_ucsize;
+     uch *eb_ucptr;
+     int r;
++    ush method;
+ 
+     if (compr_offset < 4)                /* field is not compressed: */
+         return PK_OK;                    /* do nothing and signal OK */
+@@ -2226,6 +2227,13 @@ static int test_compr_eb(__G__ eb, eb_si
+          eb_size <= (compr_offset + EB_CMPRHEADLEN)))
+         return IZ_EF_TRUNC;               /* no compressed data! */
+ 
++    method = makeword(eb + (EB_HEADSIZE + compr_offset));
++    if ((method == STORED) &&
++        (eb_size - compr_offset - EB_CMPRHEADLEN != eb_ucsize))
++	return PK_ERR;			  /* compressed & uncompressed
++					   * should match in STORED
++					   * method */
++
+     if (
+ #ifdef INT_16BIT
+         (((ulg)(extent)eb_ucsize) != eb_ucsize) ||
diff --git a/nixpkgs/pkgs/tools/archivers/unzip/CVE-2014-9913.patch b/nixpkgs/pkgs/tools/archivers/unzip/CVE-2014-9913.patch
new file mode 100644
index 000000000000..a5675f4fb7c0
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unzip/CVE-2014-9913.patch
@@ -0,0 +1,29 @@
+From: "Steven M. Schweda" <sms@antinode.info>
+Subject: Fix CVE-2014-9913, buffer overflow in unzip
+Bug: https://sourceforge.net/p/infozip/bugs/27/
+Bug-Debian: https://bugs.debian.org/847485
+Bug-Ubuntu: https://launchpad.net/bugs/387350
+X-Debian-version: 6.0-21
+
+--- a/list.c
++++ b/list.c
+@@ -339,7 +339,18 @@
+                 G.crec.compression_method == ENHDEFLATED) {
+                 methbuf[5] = dtype[(G.crec.general_purpose_bit_flag>>1) & 3];
+             } else if (methnum >= NUM_METHODS) {
+-                sprintf(&methbuf[4], "%03u", G.crec.compression_method);
++                /* 2013-02-26 SMS.
++                 * http://sourceforge.net/p/infozip/bugs/27/  CVE-2014-9913.
++                 * Unexpectedly large compression methods overflow
++                 * &methbuf[].  Use the old, three-digit decimal format
++                 * for values which fit.  Otherwise, sacrifice the
++                 * colon, and use four-digit hexadecimal.
++                 */
++                if (G.crec.compression_method <= 999) {
++                    sprintf( &methbuf[ 4], "%03u", G.crec.compression_method);
++                } else {
++                    sprintf( &methbuf[ 3], "%04X", G.crec.compression_method);
++                }
+             }
+ 
+ #if 0       /* GRR/Euro:  add this? */
diff --git a/nixpkgs/pkgs/tools/archivers/unzip/CVE-2015-7696.diff b/nixpkgs/pkgs/tools/archivers/unzip/CVE-2015-7696.diff
new file mode 100644
index 000000000000..3aad17bddd78
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unzip/CVE-2015-7696.diff
@@ -0,0 +1,66 @@
+From 68efed87fabddd450c08f3112f62a73f61d493c9 Mon Sep 17 00:00:00 2001
+From: Petr Stodulka <pstodulk@redhat.com>
+Date: Mon, 14 Sep 2015 18:23:17 +0200
+Subject: [PATCH 1/2] upstream fix for heap overflow
+
+https://bugzilla.redhat.com/attachment.cgi?id=1073002
+---
+ crypt.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/crypt.c b/crypt.c
+index 784e411..a8975f2 100644
+--- a/crypt.c
++++ b/crypt.c
+@@ -465,7 +465,17 @@ int decrypt(__G__ passwrd)
+     GLOBAL(pInfo->encrypted) = FALSE;
+     defer_leftover_input(__G);
+     for (n = 0; n < RAND_HEAD_LEN; n++) {
+-        b = NEXTBYTE;
++        /* 2012-11-23 SMS.  (OUSPG report.)
++         * Quit early if compressed size < HEAD_LEN.  The resulting
++         * error message ("unable to get password") could be improved,
++         * but it's better than trying to read nonexistent data, and
++         * then continuing with a negative G.csize.  (See
++         * fileio.c:readbyte()).
++         */
++        if ((b = NEXTBYTE) == (ush)EOF)
++        {
++            return PK_ERR;
++        }
+         h[n] = (uch)b;
+         Trace((stdout, " (%02x)", h[n]));
+     }
+-- 
+2.4.6
+
+
+From bd8a743ee0a77e65ad07ef4196c4cd366add3f26 Mon Sep 17 00:00:00 2001
+From: Kamil Dudka <kdudka@redhat.com>
+Date: Mon, 14 Sep 2015 18:24:56 +0200
+Subject: [PATCH 2/2] fix infinite loop when extracting empty bzip2 data
+
+---
+ extract.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/extract.c b/extract.c
+index 7134bfe..29db027 100644
+--- a/extract.c
++++ b/extract.c
+@@ -2733,6 +2733,12 @@ __GDEF
+     int repeated_buf_err;
+     bz_stream bstrm;
+ 
++    if (G.incnt <= 0 && G.csize <= 0L) {
++        /* avoid an infinite loop */
++        Trace((stderr, "UZbunzip2() got empty input\n"));
++        return 2;
++    }
++
+ #if (defined(DLL) && !defined(NO_SLIDE_REDIR))
+     if (G.redirect_slide)
+         wsize = G.redirect_size, redirSlide = G.redirect_buffer;
+-- 
+2.4.6
+
diff --git a/nixpkgs/pkgs/tools/archivers/unzip/CVE-2015-7697.diff b/nixpkgs/pkgs/tools/archivers/unzip/CVE-2015-7697.diff
new file mode 100644
index 000000000000..98ebf53c4782
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unzip/CVE-2015-7697.diff
@@ -0,0 +1,36 @@
+From bd150334fb4084f5555a6be26b015a0671cb5b74 Mon Sep 17 00:00:00 2001
+From: Kamil Dudka <kdudka@redhat.com>
+Date: Tue, 22 Sep 2015 18:52:23 +0200
+Subject: [PATCH] extract: prevent unsigned overflow on invalid input
+
+Suggested-by: Stefan Cornelius
+---
+ extract.c | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/extract.c b/extract.c
+index 29db027..b9ae667 100644
+--- a/extract.c
++++ b/extract.c
+@@ -1257,8 +1257,17 @@ static int extract_or_test_entrylist(__G__ numchunk,
+         if (G.lrec.compression_method == STORED) {
+             zusz_t csiz_decrypted = G.lrec.csize;
+ 
+-            if (G.pInfo->encrypted)
++            if (G.pInfo->encrypted) {
++                if (csiz_decrypted <= 12) {
++                    /* handle the error now to prevent unsigned overflow */
++                    Info(slide, 0x401, ((char *)slide,
++                      LoadFarStringSmall(ErrUnzipNoFile),
++                      LoadFarString(InvalidComprData),
++                      LoadFarStringSmall2(Inflate)));
++                    return PK_ERR;
++                }
+                 csiz_decrypted -= 12;
++            }
+             if (G.lrec.ucsize != csiz_decrypted) {
+                 Info(slide, 0x401, ((char *)slide,
+                   LoadFarStringSmall2(WrnStorUCSizCSizDiff),
+-- 
+2.5.2
+
diff --git a/nixpkgs/pkgs/tools/archivers/unzip/CVE-2016-9844.patch b/nixpkgs/pkgs/tools/archivers/unzip/CVE-2016-9844.patch
new file mode 100644
index 000000000000..52d07987b333
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unzip/CVE-2016-9844.patch
@@ -0,0 +1,28 @@
+From: "Steven M. Schweda" <sms@antinode.info>
+Subject: Fix CVE-2016-9844, buffer overflow in zipinfo
+Bug-Debian: https://bugs.debian.org/847486
+Bug-Ubuntu: https://launchpad.net/bugs/1643750
+X-Debian-version: 6.0-21
+
+--- a/zipinfo.c
++++ b/zipinfo.c
+@@ -1921,7 +1921,18 @@
+         ush  dnum=(ush)((G.crec.general_purpose_bit_flag>>1) & 3);
+         methbuf[3] = dtype[dnum];
+     } else if (methnum >= NUM_METHODS) {   /* unknown */
+-        sprintf(&methbuf[1], "%03u", G.crec.compression_method);
++        /* 2016-12-05 SMS.
++         * https://launchpad.net/bugs/1643750
++         * Unexpectedly large compression methods overflow
++         * &methbuf[].  Use the old, three-digit decimal format
++         * for values which fit.  Otherwise, sacrifice the "u",
++         * and use four-digit hexadecimal.
++         */
++        if (G.crec.compression_method <= 999) {
++            sprintf( &methbuf[ 1], "%03u", G.crec.compression_method);
++        } else {
++            sprintf( &methbuf[ 0], "%04X", G.crec.compression_method);
++        }
+     }
+ 
+     for (k = 0;  k < 15;  ++k)
diff --git a/nixpkgs/pkgs/tools/archivers/unzip/CVE-2018-18384.patch b/nixpkgs/pkgs/tools/archivers/unzip/CVE-2018-18384.patch
new file mode 100644
index 000000000000..e9320e125cf6
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unzip/CVE-2018-18384.patch
@@ -0,0 +1,35 @@
+--- unzip60/list.c	
++++ unzip60/list.c	
+@@ -97,7 +97,7 @@ int list_files(__G)    /* return PK-type
+ {
+     int do_this_file=FALSE, cfactor, error, error_in_archive=PK_COOL;
+ #ifndef WINDLL
+-    char sgn, cfactorstr[10];
++    char sgn, cfactorstr[1+10+1+1];	/* <sgn><int>%NUL */
+     int longhdr=(uO.vflag>1);
+ #endif
+     int date_format;
+@@ -389,9 +389,9 @@ int list_files(__G)    /* return PK-type
+             }
+ #else /* !WINDLL */
+             if (cfactor == 100)
+-                sprintf(cfactorstr, LoadFarString(CompFactor100));
++                snprintf(cfactorstr, sizeof(cfactorstr), LoadFarString(CompFactor100));
+             else
+-                sprintf(cfactorstr, LoadFarString(CompFactorStr), sgn, cfactor);
++                snprintf(cfactorstr, sizeof(cfactorstr), LoadFarString(CompFactorStr), sgn, cfactor);
+             if (longhdr)
+                 Info(slide, 0, ((char *)slide, LoadFarString(LongHdrStats),
+                   FmZofft(G.crec.ucsize, "8", "u"), methbuf,
+@@ -471,9 +471,9 @@ int list_files(__G)    /* return PK-type
+ 
+ #else /* !WINDLL */
+         if (cfactor == 100)
+-            sprintf(cfactorstr, LoadFarString(CompFactor100));
++            snprintf(cfactorstr, sizeof(cfactorstr), LoadFarString(CompFactor100));
+         else
+-            sprintf(cfactorstr, LoadFarString(CompFactorStr), sgn, cfactor);
++            snprintf(cfactorstr, sizeof(cfactorstr), LoadFarString(CompFactorStr), sgn, cfactor);
+         if (longhdr) {
+             Info(slide, 0, ((char *)slide, LoadFarString(LongFileTrailer),
+               FmZofft(tot_ucsize, "8", "u"), FmZofft(tot_csize, "8", "u"),
diff --git a/nixpkgs/pkgs/tools/archivers/unzip/default.nix b/nixpkgs/pkgs/tools/archivers/unzip/default.nix
new file mode 100644
index 000000000000..b0a4484e87f3
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unzip/default.nix
@@ -0,0 +1,106 @@
+{ lib, stdenv, fetchurl
+, bzip2
+, enableNLS ? false, libnatspec
+}:
+
+stdenv.mkDerivation rec {
+  pname = "unzip";
+  version = "6.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/infozip/unzip${lib.replaceStrings ["."] [""] version}.tar.gz";
+    sha256 = "0dxx11knh3nk95p2gg2ak777dd11pr7jx5das2g49l262scrcv83";
+  };
+
+  hardeningDisable = [ "format" ];
+
+  patchFlags = [ "-p1" "-F3" ];
+
+  patches = [
+    ./CVE-2014-8139.diff
+    ./CVE-2014-8140.diff
+    ./CVE-2014-8141.diff
+    ./CVE-2014-9636.diff
+    ./CVE-2015-7696.diff
+    ./CVE-2015-7697.diff
+    ./CVE-2014-9913.patch
+    ./CVE-2016-9844.patch
+    ./CVE-2018-18384.patch
+    ./dont-hardcode-cc.patch
+    (fetchurl {
+      url = "https://github.com/madler/unzip/commit/41beb477c5744bc396fa1162ee0c14218ec12213.patch";
+      name = "CVE-2019-13232-1.patch";
+      sha256 = "04jzd6chg9fw4l5zadkfsrfm5llrd7vhd1dgdjjd29nrvkrjyn14";
+    })
+    (fetchurl {
+      url = "https://github.com/madler/unzip/commit/47b3ceae397d21bf822bc2ac73052a4b1daf8e1c.patch";
+      name = "CVE-2019-13232-2.patch";
+      sha256 = "0iy2wcjyvzwrjk02iszwcpg85fkjxs1bvb9isvdiywszav4yjs32";
+    })
+    (fetchurl {
+      url = "https://github.com/madler/unzip/commit/6d351831be705cc26d897db44f878a978f4138fc.patch";
+      name = "CVE-2019-13232-3.patch";
+      sha256 = "1jvs7dkdqs97qnsqc6hk088alhv8j4c638k65dbib9chh40jd7pf";
+    })
+    (fetchurl {
+      urls = [
+        # original link (will be dead eventually):
+        "https://sources.debian.org/data/main/u/unzip/6.0-26%2Bdeb11u1/debian/patches/06-initialize-the-symlink-flag.patch"
+
+        "https://gist.github.com/veprbl/41261bb781571e2246ea42d3f37795f5/raw/d8533d8c6223150f76b0f31aec03e185fcde3579/06-initialize-the-symlink-flag.patch"
+      ];
+      sha256 = "1h00djdvgjhwfb60wl4qrxbyfsbbnn1qw6l2hkldnif4m8f8r1zj";
+    })
+    (fetchurl {
+      urls = [
+        # original link (will be dead eventually):
+        "https://sources.debian.org/data/main/u/unzip/6.0-27/debian/patches/28-cve-2022-0529-and-cve-2022-0530.patch"
+
+        "https://web.archive.org/web/20230106200319/https://sources.debian.org/data/main/u/unzip/6.0-27/debian/patches/28-cve-2022-0529-and-cve-2022-0530.patch"
+      ];
+      sha256 = "sha256-on79jElQ+z2ULWAq14RpluAqr9d6itHiZwDkKubBzTc=";
+    })
+    # Clang 16 makes implicit declarations an error by default for C99 and newer, causing the
+    # configure script to fail to detect errno and the directory libraries on Darwin.
+    ./implicit-declarations-fix.patch
+  ] ++ lib.optional enableNLS
+    (fetchurl {
+      url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/app-arch/unzip/files/unzip-6.0-natspec.patch?id=56bd759df1d0c750a065b8c845e93d5dfa6b549d";
+      name = "unzip-6.0-natspec.patch";
+      sha256 = "67ab260ae6adf8e7c5eda2d1d7846929b43562943ec4aff629bd7018954058b1";
+    });
+
+
+  nativeBuildInputs = [ bzip2 ];
+  buildInputs = [ bzip2 ] ++ lib.optional enableNLS libnatspec;
+
+  makefile = "unix/Makefile";
+
+  NIX_LDFLAGS = "-lbz2" + lib.optionalString enableNLS " -lnatspec";
+
+  buildFlags = [
+    "generic"
+    "D_USE_BZ2=-DUSE_BZIP2"
+    "L_BZ2=-lbz2"
+  ]
+  # `lchmod` is not available on Linux, so we remove it to fix "not supported" errors (when the zip file contains symlinks).
+  # Alpine (musl) and Debian (glibc) also add this flag.
+  ++ lib.optionals stdenv.isLinux [ "LOCAL_UNZIP=-DNO_LCHMOD" ];
+
+  preConfigure = ''
+    sed -i -e 's@CF="-O3 -Wall -I. -DASM_CRC $(LOC)"@CF="-O3 -Wall -I. -DASM_CRC -DLARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(LOC)"@' unix/Makefile
+  '';
+
+  installFlags = [
+    "prefix=${placeholder "out"}"
+  ];
+
+  setupHook = ./setup-hook.sh;
+
+  meta = {
+    homepage = "http://www.info-zip.org";
+    description = "An extraction utility for archives compressed in .zip format";
+    license = lib.licenses.free; # http://www.info-zip.org/license.html
+    platforms = lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/unzip/dont-hardcode-cc.patch b/nixpkgs/pkgs/tools/archivers/unzip/dont-hardcode-cc.patch
new file mode 100644
index 000000000000..15dbbfe4c533
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unzip/dont-hardcode-cc.patch
@@ -0,0 +1,14 @@
+--- a/unix/Makefile
++++ b/unix/Makefile
+@@ -42,9 +42,9 @@
+ # such as -DDOSWILD).
+ 
+ # UnZip flags
+-CC = cc#	try using "gcc" target rather than changing this (CC and LD
++CC ?= cc#	try using "gcc" target rather than changing this (CC and LD
+ LD = $(CC)#	must match, else "unresolved symbol:  ___main" is possible)
+-AS = as
++AS ?= as
+ LOC = $(D_USE_BZ2) $(LOCAL_UNZIP)
+ AF = $(LOC)
+ CFLAGS = -O
diff --git a/nixpkgs/pkgs/tools/archivers/unzip/implicit-declarations-fix.patch b/nixpkgs/pkgs/tools/archivers/unzip/implicit-declarations-fix.patch
new file mode 100644
index 000000000000..df19bf1722f9
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unzip/implicit-declarations-fix.patch
@@ -0,0 +1,21 @@
+--- a/unix/configure	2009-04-16 15:25:12.000000000 -0400
++++ b/unix/configure	2023-05-30 15:18:33.670321348 -0400
+@@ -408,7 +408,7 @@
+ echo Check for errno declaration
+ cat > conftest.c << _EOF_
+ #include <errno.h>
+-main()
++int main()
+ {
+   errno = 0;
+   return 0;
+@@ -419,6 +419,8 @@
+ 
+ echo Check for directory libraries
+ cat > conftest.c << _EOF_
++#include <sys/types.h>
++#include <dirent.h>
+ int main() { return closedir(opendir(".")); }
+ _EOF_
+ 
+
diff --git a/nixpkgs/pkgs/tools/archivers/unzip/setup-hook.sh b/nixpkgs/pkgs/tools/archivers/unzip/setup-hook.sh
new file mode 100644
index 000000000000..99c63f68e940
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unzip/setup-hook.sh
@@ -0,0 +1,11 @@
+unpackCmdHooks+=(_tryUnzip)
+_tryUnzip() {
+    if ! [[ "$curSrc" =~ \.zip$ ]]; then return 1; fi
+
+    # UTF-8 locale is needed for unzip on glibc to handle UTF-8 symbols:
+    #   https://github.com/NixOS/nixpkgs/issues/176225#issuecomment-1146617263
+    # Otherwise unzip unpacks escaped file names as if '-U' options was in effect.
+    #
+    # Pick en_US.UTF-8 as most possible to be present on glibc, musl and darwin.
+    LANG=en_US.UTF-8 unzip -qq "$curSrc"
+}
diff --git a/nixpkgs/pkgs/tools/archivers/unzoo/default.nix b/nixpkgs/pkgs/tools/archivers/unzoo/default.nix
new file mode 100644
index 000000000000..c8fd4364ea33
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unzoo/default.nix
@@ -0,0 +1,44 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+}:
+
+stdenv.mkDerivation rec {
+  pname = "unzoo";
+  version = "4.4";
+
+  src = fetchFromGitHub {
+    owner = "museoa";
+    repo = pname;
+    rev = version;
+    hash = "sha256-oPq1I7EsvHaJ7anHbm/KWrYrxJkM79rLhgRfSAdoLtk=";
+  };
+
+  outputs = [ "out" "doc" ];
+
+  buildPhase = ''
+    runHook preBuild
+
+    ${stdenv.cc.targetPrefix}cc -o unzoo -DSYS_IS_UNIX src/unzoo.c
+
+    runHook postBuild
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p $out/bin $doc/share/doc/${pname}
+    cp unzoo $out/bin
+    cp README.TXT $doc/share/doc/${pname}
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/museoa/unzoo/";
+    description = "Manipulate archives of files in Zoo compressed form";
+    license = licenses.publicDomain;
+    maintainers = with maintainers; [ AndersonTorres ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/wimlib/default.nix b/nixpkgs/pkgs/tools/archivers/wimlib/default.nix
new file mode 100644
index 000000000000..f5faa099f88e
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/wimlib/default.nix
@@ -0,0 +1,48 @@
+{ lib, stdenv, fetchurl, makeWrapper
+, pkg-config, openssl, fuse, libxml2
+, cabextract ? null
+, cdrkit ? null
+, mtools ? null
+, ntfs3g ? null
+, syslinux ? null
+}:
+
+stdenv.mkDerivation rec {
+  version = "1.13.6";
+  pname = "wimlib";
+
+  nativeBuildInputs = [ pkg-config makeWrapper ];
+  buildInputs = [ openssl fuse libxml2 ntfs3g ];
+
+  src = fetchurl {
+    url = "https://wimlib.net/downloads/${pname}-${version}.tar.gz";
+    sha256 = "sha256-Cg+cHA06KnZkVTWusPYuA/xVkUymXzpNVZm7iwJg29k=";
+  };
+
+  preBuild = lib.optionalString (!stdenv.isDarwin) ''
+    substituteInPlace programs/mkwinpeimg.in \
+      --replace '/usr/lib/syslinux' "${syslinux}/share/syslinux"
+  '';
+
+  postInstall = let
+    path = lib.makeBinPath  ([ cabextract mtools ntfs3g ] ++ lib.optionals (!stdenv.isDarwin) [ cdrkit syslinux ]);
+  in ''
+    for prog in $out/bin/*; do
+      wrapProgram $prog --prefix PATH : ${path}
+    done
+  '';
+
+  doCheck = (!stdenv.isDarwin);
+
+  preCheck = ''
+    patchShebangs tests
+  '';
+
+  meta = with lib; {
+    homepage = "https://wimlib.net";
+    description = "A library and program to extract, create, and modify WIM files";
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ ];
+    license = with licenses; [ gpl3 lgpl3 cc0 ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/xarchive/default.nix b/nixpkgs/pkgs/tools/archivers/xarchive/default.nix
new file mode 100644
index 000000000000..d28e9f31b1ab
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/xarchive/default.nix
@@ -0,0 +1,23 @@
+{ lib, stdenv, fetchurl, gtk2, pkg-config }:
+
+stdenv.mkDerivation rec {
+  version = "0.2.8-6";
+  pname = "xarchive";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/xarchive/${pname}-${version}.tar.gz";
+    sha256 = "0chfim7z27s00naf43a61zsngwhvim14mg1p3csbv5i3f6m50xx4";
+  };
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ gtk2 ];
+
+  hardeningDisable = [ "format" ];
+
+  meta = {
+    description = "A GTK front-end for command line archiving tools";
+    maintainers = [ lib.maintainers.domenkozar ];
+    license = lib.licenses.gpl2;
+    platforms = lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/xarchiver/default.nix b/nixpkgs/pkgs/tools/archivers/xarchiver/default.nix
new file mode 100644
index 000000000000..84052c475e92
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/xarchiver/default.nix
@@ -0,0 +1,31 @@
+{ lib, stdenv, fetchFromGitHub, gtk3, pkg-config, intltool, libxslt, makeWrapper,
+  coreutils, zip, unzip, p7zip, unar, gnutar, bzip2, gzip, lhasa, wrapGAppsHook }:
+
+stdenv.mkDerivation rec {
+  version = "0.5.4.21";
+  pname = "xarchiver";
+
+  src = fetchFromGitHub {
+    owner = "ib";
+    repo = "xarchiver";
+    rev = version;
+    sha256 = "sha256-pYrF9fyEbay+iboL9EuoTETTI3RTcgv3yeVtAWvAe1Q=";
+  };
+
+  nativeBuildInputs = [ intltool pkg-config makeWrapper wrapGAppsHook ];
+  buildInputs = [ gtk3 libxslt ];
+
+  postFixup = ''
+    wrapProgram $out/bin/xarchiver \
+    --prefix PATH : ${lib.makeBinPath [ zip unzip p7zip unar gnutar bzip2 gzip lhasa coreutils ]}
+  '';
+
+  meta = {
+    broken = stdenv.isDarwin;
+    description = "GTK frontend to 7z,zip,rar,tar,bzip2, gzip,arj, lha, rpm and deb (open and extract only)";
+    homepage = "https://github.com/ib/xarchiver";
+    maintainers = [ lib.maintainers.domenkozar ];
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/zarchive/default.nix b/nixpkgs/pkgs/tools/archivers/zarchive/default.nix
new file mode 100644
index 000000000000..442257779c89
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/zarchive/default.nix
@@ -0,0 +1,23 @@
+{ lib, stdenv, fetchFromGitHub, cmake, zstd }:
+
+stdenv.mkDerivation rec {
+  pname = "zarchive";
+  version = "0.1.2";
+
+  src = fetchFromGitHub {
+    owner = "Exzap";
+    repo = "ZArchive";
+    rev = "v${version}";
+    hash = "sha256-hX637O/mVLTzmG0a9swJu9w+3o26VHo+K/9RhMuf1lI=";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ zstd ];
+
+  meta = with lib; {
+    description = "File archive format supporting random-access reads";
+    homepage = "https://github.com/Exzap/ZArchive";
+    license = licenses.mit0;
+    maintainers = with maintainers; [ zhaofengli ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/zip/default.nix b/nixpkgs/pkgs/tools/archivers/zip/default.nix
new file mode 100644
index 000000000000..82329537251e
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/zip/default.nix
@@ -0,0 +1,41 @@
+{ lib, stdenv, fetchurl, enableNLS ? false, libnatspec ? null, libiconv }:
+
+assert enableNLS -> libnatspec != null;
+
+stdenv.mkDerivation rec {
+  pname = "zip";
+  version = "3.0";
+
+  src = fetchurl {
+    urls = [
+      "ftp://ftp.info-zip.org/pub/infozip/src/zip${lib.replaceStrings ["."] [""] version}.tgz"
+      "https://src.fedoraproject.org/repo/pkgs/zip/zip30.tar.gz/7b74551e63f8ee6aab6fbc86676c0d37/zip30.tar.gz"
+    ];
+    sha256 = "0sb3h3067pzf3a7mlxn1hikpcjrsvycjcnj9hl9b1c3ykcgvps7h";
+  };
+  patchPhase = ''
+    substituteInPlace unix/Makefile --replace 'CC = cc' ""
+  '';
+
+  hardeningDisable = [ "format" ];
+
+  makefile = "unix/Makefile";
+  buildFlags = if stdenv.isCygwin then [ "cygwin" ] else [ "generic" ];
+  installFlags = [
+    "prefix=${placeholder "out"}"
+    "INSTALL=cp"
+  ];
+
+  patches = lib.optionals (enableNLS && !stdenv.isCygwin) [ ./natspec-gentoo.patch.bz2 ];
+
+  buildInputs = lib.optional enableNLS libnatspec
+    ++ lib.optional stdenv.isCygwin libiconv;
+
+  meta = with lib; {
+    description = "Compressor/archiver for creating and modifying zipfiles";
+    homepage = "http://www.info-zip.org";
+    license = licenses.bsdOriginal;
+    platforms = platforms.all;
+    maintainers = [ ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/zip/natspec-gentoo.patch.bz2 b/nixpkgs/pkgs/tools/archivers/zip/natspec-gentoo.patch.bz2
new file mode 100644
index 000000000000..816f32aba3c3
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/zip/natspec-gentoo.patch.bz2
Binary files differdiff --git a/nixpkgs/pkgs/tools/archivers/zpaq/default.nix b/nixpkgs/pkgs/tools/archivers/zpaq/default.nix
new file mode 100644
index 000000000000..6d0f00f51490
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/zpaq/default.nix
@@ -0,0 +1,32 @@
+{ lib, stdenv, fetchFromGitHub, perl }:
+
+stdenv.mkDerivation rec {
+  pname = "zpaq";
+  version = "7.15";
+
+  src = fetchFromGitHub {
+    owner = "zpaq";
+    repo = "zpaq";
+    rev = version;
+    sha256 = "0v44rlg9gvwc4ggr2lhcqll8ppal3dk7zsg5bqwcc5lg3ynk2pz4";
+  };
+
+  nativeBuildInputs = [ perl /* for pod2man */ ];
+
+  CPPFLAGS = [ "-Dunix" ] ++
+    lib.optional (!stdenv.isi686 && !stdenv.isx86_64) "-DNOJIT";
+  CXXFLAGS = [ "-O3" "-DNDEBUG" ];
+
+  enableParallelBuilding = true;
+
+  makeFlags = [ "CXX=${stdenv.cc.targetPrefix}c++" ];
+  installFlags = [ "PREFIX=$(out)" ];
+
+  meta = with lib; {
+    description = "Incremental journaling backup utility and archiver";
+    homepage = "http://mattmahoney.net/dc/zpaq.html";
+    license = licenses.gpl3Plus ;
+    maintainers = with maintainers; [ raskin ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/zpaq/zpaqd.nix b/nixpkgs/pkgs/tools/archivers/zpaq/zpaqd.nix
new file mode 100644
index 000000000000..6896897be3b1
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/zpaq/zpaqd.nix
@@ -0,0 +1,40 @@
+{ lib, stdenv, fetchurl, unzip }:
+
+let
+  compileFlags = lib.concatStringsSep " " ([ "-O3" "-DNDEBUG" ]
+    ++ lib.optional (stdenv.hostPlatform.isUnix) "-Dunix -pthread"
+    ++ lib.optional (!stdenv.hostPlatform.isx86) "-DNOJIT");
+in
+stdenv.mkDerivation rec {
+  pname = "zpaqd";
+  version = "715";
+
+  src = fetchurl {
+    url = "http://mattmahoney.net/dc/zpaqd${version}.zip";
+    sha256 = "sha256-Mx87Zt0AASk0ZZCjyTzYbhlYJAXBlb59OpUWsqynyCA=";
+  };
+
+  sourceRoot = ".";
+
+  nativeBuildInputs = [ unzip ];
+
+  buildPhase = ''
+    $CXX ${compileFlags} -fPIC --shared libzpaq.cpp -o libzpaq.so
+    $CXX ${compileFlags} -L. -L"$out/lib" -lzpaq zpaqd.cpp -o zpaqd
+  '';
+
+  installPhase = ''
+    mkdir -p "$out"/{bin,include,lib,share/doc/zpaq}
+    cp libzpaq.so "$out/lib"
+    cp zpaqd "$out/bin"
+    cp libzpaq.h "$out/include"
+    cp readme_zpaqd.txt "$out/share/doc/zpaq"
+  '';
+
+  meta = with lib; {
+    description = "ZPAQ archive (de)compressor and algorithm development tool";
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ raskin ];
+    platforms = platforms.linux;
+  };
+}