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.nix47
-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.nix58
-rw-r--r--nixpkgs/pkgs/tools/archivers/arj/default.nix150
-rw-r--r--nixpkgs/pkgs/tools/archivers/atool/default.nix19
-rw-r--r--nixpkgs/pkgs/tools/archivers/bomutils/default.nix28
-rw-r--r--nixpkgs/pkgs/tools/archivers/cabextract/default.nix18
-rw-r--r--nixpkgs/pkgs/tools/archivers/cpio/default.nix27
-rw-r--r--nixpkgs/pkgs/tools/archivers/cromfs/default.nix31
-rw-r--r--nixpkgs/pkgs/tools/archivers/ctrtool/default.nix31
-rw-r--r--nixpkgs/pkgs/tools/archivers/fsarchiver/default.nix44
-rw-r--r--nixpkgs/pkgs/tools/archivers/gnutar/default.nix73
-rw-r--r--nixpkgs/pkgs/tools/archivers/innoextract/default.nix35
-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.nix55
-rw-r--r--nixpkgs/pkgs/tools/archivers/p7zip/setup-hook.sh5
-rw-r--r--nixpkgs/pkgs/tools/archivers/pax/default.nix30
-rw-r--r--nixpkgs/pkgs/tools/archivers/pxattr/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/archivers/quickbms/default.nix23
-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.nix72
-rw-r--r--nixpkgs/pkgs/tools/archivers/snzip/default.nix31
-rw-r--r--nixpkgs/pkgs/tools/archivers/unar/default.nix66
-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.nix45
-rw-r--r--nixpkgs/pkgs/tools/archivers/unrar/default.nix48
-rw-r--r--nixpkgs/pkgs/tools/archivers/unrar/setup-hook.sh5
-rw-r--r--nixpkgs/pkgs/tools/archivers/unshield/default.nix24
-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.nix80
-rw-r--r--nixpkgs/pkgs/tools/archivers/unzip/dont-hardcode-cc.patch14
-rw-r--r--nixpkgs/pkgs/tools/archivers/unzip/setup-hook.sh5
-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.nix30
-rw-r--r--nixpkgs/pkgs/tools/archivers/xtrt/default.nix36
-rw-r--r--nixpkgs/pkgs/tools/archivers/zip/default.nix40
-rw-r--r--nixpkgs/pkgs/tools/archivers/zip/natspec-gentoo.patch.bz2bin0 -> 1914 bytes
-rw-r--r--nixpkgs/pkgs/tools/archivers/zpaq/default.nix36
-rw-r--r--nixpkgs/pkgs/tools/archivers/zpaq/default.upstream6
-rw-r--r--nixpkgs/pkgs/tools/archivers/zpaq/zpaqd.nix48
-rw-r--r--nixpkgs/pkgs/tools/archivers/zpaq/zpaqd.upstream5
58 files changed, 2136 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..63e603353409
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/7zz/default.nix
@@ -0,0 +1,47 @@
+{ lib, stdenv, fetchurl, autoPatchelfHook }:
+
+let platform =       if stdenv.isi686    then "x86"
+                else if stdenv.isx86_64  then "x64"
+                else if stdenv.isAarch32 then "arm"
+                else if stdenv.isAarch64 then "arm64"
+                else throw "Unsupported architecture";
+
+    url = "https://7-zip.org/a/7z2101-linux-${platform}.tar.xz";
+
+    hashes = {
+      x86 = "0k6vg85ld8i2pcv5sv3xbvf3swqh9qj8hf2jcpadssys3yyidqyj";
+      x64 = "1yfanx98fizj8d2s87yxgsy30zydx7h5w9wf4wy3blgsp0vkbjb3";
+      arm = "04iah9vijm86r8rbkhxig86fx3lpag4xi7i3vq7gfrlwkymclhm1";
+      arm64 = "0a26ginpb22aydcyvffxpbi7lxh4sgs9gb6cj96qqx7cnf7bk2ri";
+    };
+    sha256 = hashes."${platform}";
+
+in stdenv.mkDerivation {
+  pname = "7zz";
+  version = "21.01";
+
+  src = fetchurl { inherit url sha256; };
+  sourceRoot = ".";
+
+  nativeBuildInputs = [ autoPatchelfHook ];
+  buildInputs = [ stdenv.cc.cc.lib ];
+
+  dontBuild = true;
+
+  installPhase = ''
+    runHook preInstall
+    install -D -t $out/bin 7zz
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    description = "Command line archiver utility";
+    homepage = "https://www.7-zip.org";
+
+    # source not released yet. will be under LGPL 2.1+ with RAR exception
+    license = licenses.unfree;
+
+    platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" "armv7l-linux" ];
+    maintainers = with maintainers; [ anna328p ];
+  };
+}
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..edf67f2f963b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/arc_unpacker/default.nix
@@ -0,0 +1,58 @@
+{ lib, stdenv, fetchFromGitHub, cmake, makeWrapper, boost, libpng, libiconv
+, libjpeg, zlib, openssl, libwebp, catch }:
+
+stdenv.mkDerivation rec {
+  pname = "arc_unpacker";
+  version = "unstable-2021-05-17";
+
+  src = fetchFromGitHub {
+    owner = "vn-tools";
+    repo = "arc_unpacker";
+    # Since the latest release (0.11) doesn't build, we've opened an upstream
+    # issue in https://github.com/vn-tools/arc_unpacker/issues/187 to ask if a
+    # a new release is upcoming
+    rev = "9c2781fcf3ead7641e873b65899f6abeeabb2fc8";
+    sha256 = "1xxrc9nww0rla3yh10z6glv05ax4rynwwbd0cdvkp7gyqzrv97xp";
+  };
+
+  nativeBuildInputs = [ cmake makeWrapper catch ];
+  buildInputs = [ boost libpng libjpeg zlib openssl libwebp ]
+    ++ lib.optionals stdenv.isDarwin [ libiconv ];
+
+  postPatch = ''
+    cp ${catch}/include/catch/catch.hpp tests/test_support/catch.h
+  '';
+
+  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
+  doCheck = !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..e09e390fa473
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/arj/default.nix
@@ -0,0 +1,150 @@
+{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 ];
+
+  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..419a7d04ee33
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/atool/default.nix
@@ -0,0 +1,19 @@
+{lib, stdenv, fetchurl, perl, bash}:
+
+stdenv.mkDerivation {
+  name = "atool-0.39.0";
+  src = fetchurl {
+    url = "mirror://savannah/atool/atool-0.39.0.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..c4ff957135ff
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/bomutils/default.nix
@@ -0,0 +1,28 @@
+{ 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++"
+  ];
+
+  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..3ed07544bb2b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/cabextract/default.nix
@@ -0,0 +1,18 @@
+{ lib, stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "cabextract-1.9.1";
+
+  src = fetchurl {
+    url = "https://www.cabextract.org.uk/${name}.tar.gz";
+    sha256 = "19qwhl2r8ip95q4vxzxg2kp4p125hjmc9762sns1dwwf7ikm7hmg";
+  };
+
+  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..5b88e10b1c37
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/cpio/default.nix
@@ -0,0 +1,27 @@
+{ lib, stdenv, fetchurl }:
+
+let
+  version = "2.13";
+  name = "cpio-${version}";
+in stdenv.mkDerivation {
+  inherit name;
+
+  src = fetchurl {
+    url = "mirror://gnu/cpio/${name}.tar.bz2";
+    sha256 = "0vbgnhkawdllgnkdn6zn1f56fczwk0518krakz2qbwhxmv2vvdga";
+  };
+
+  preConfigure = if stdenv.isCygwin then ''
+    sed -i gnu/fpending.h -e 's,include <stdio_ext.h>,,'
+  '' else null;
+
+  enableParallelBuilding = true;
+
+  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..bed0485e44a2
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/cromfs/default.nix
@@ -0,0 +1,31 @@
+{ lib, stdenv, fetchurl, pkg-config, fuse, perl }:
+
+stdenv.mkDerivation rec {
+  name = "cromfs-1.5.10.2";
+
+  src = fetchurl {
+    url = "https://bisqwit.iki.fi/src/arch/${name}.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..4743f7ded3e8
--- /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 = "source/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/fsarchiver/default.nix b/nixpkgs/pkgs/tools/archivers/fsarchiver/default.nix
new file mode 100644
index 000000000000..80664a6a4499
--- /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, libgpgerror }:
+
+let
+  version = "0.8.6";
+
+in stdenv.mkDerivation {
+  pname = "fsarchiver";
+  inherit version;
+
+  src = fetchFromGitHub {
+    owner = "fdupoux";
+    repo = "fsarchiver";
+    rev = version;
+    sha256 = "sha256-7AfCI4abcUijobEl6FO+5A/FRwxPkNko44u85WbTwuc=";
+  };
+
+  nativeBuildInputs = [
+    autoreconfHook pkg-config
+  ];
+
+  buildInputs = [
+    zlib bzip2 xz lzo lz4 zstd xz
+    libgcrypt e2fsprogs util-linux libgpgerror
+  ];
+
+  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 = [ maintainers.etu ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/gnutar/default.nix b/nixpkgs/pkgs/tools/archivers/gnutar/default.nix
new file mode 100644
index 000000000000..fcc92e673a55
--- /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 = {
+    homepage = "https://www.gnu.org/software/tar/";
+    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).
+    '';
+
+    license = lib.licenses.gpl3Plus;
+
+    maintainers = [ ];
+    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..4822ea82d1e6
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/innoextract/default.nix
@@ -0,0 +1,35 @@
+{ lib, stdenv, fetchurl, cmake, makeWrapper
+, boost, xz
+, withGog ? false, unar ? null }:
+
+stdenv.mkDerivation rec {
+  name = "innoextract-1.9";
+
+  src = fetchurl {
+    url = "https://constexpr.org/innoextract/files/${name}.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..ed81a1825257
--- /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.12.0";
+
+  src = fetchFromGitHub {
+    owner = "unknownbrackets";
+    repo = "maxcso";
+    rev = "v${version}";
+    sha256 = "10r0vb3ndpq1pw5224d48nim5xz8jj94zhlfy29br6h6jblq8zap";
+  };
+
+  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..96f9262427b0
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/p7zip/default.nix
@@ -0,0 +1,55 @@
+{ stdenv, fetchFromGitHub, fetchpatch, lib, enableUnfree ? false }:
+
+stdenv.mkDerivation rec {
+  pname = "p7zip";
+  version = "17.04";
+
+  src = fetchFromGitHub {
+    owner  = "jinfeihan57";
+    repo   = pname;
+    rev    = "v${version}";
+    sha256 = "sha256-19F4hPV0nKVuFZNbOcXrcA1uW6Y3HQolaHVIYXGmh18=";
+  };
+
+  # 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
+    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++'
+  '' + lib.optionalString (!enableUnfree) ''
+    # Remove non-free RAR source code
+    # (see DOC/License.txt, https://fedoraproject.org/wiki/Licensing:Unrar)
+    rm -r CPP/7zip/Compress/Rar*
+    find . -name makefile'*' -exec sed -i '/Rar/d' {} +
+  '';
+
+  makeFlags = [ "DEST_HOME=${placeholder "out"}" ];
+
+  preConfigure = ''
+    buildFlags=all3
+  '' + lib.optionalString stdenv.isDarwin ''
+    cp makefile.macosx_llvm_64bits makefile.machine
+  '';
+
+  enableParallelBuilding = true;
+
+  setupHook = ./setup-hook.sh;
+
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=c++11-narrowing";
+
+  meta = {
+    homepage = "https://github.com/jinfeihan57/p7zip";
+    description = "A new p7zip fork with additional codecs and improvements (forked from https://sourceforge.net/projects/p7zip/)";
+    platforms = lib.platforms.unix;
+    maintainers = [ lib.maintainers.raskin ];
+    mainProgram = "7z";
+    # RAR code is under non-free UnRAR license, but we remove it
+    license = if enableUnfree then lib.licenses.unfree else lib.licenses.lgpl2Plus;
+  };
+}
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/pax/default.nix b/nixpkgs/pkgs/tools/archivers/pax/default.nix
new file mode 100644
index 000000000000..d554ea4dade3
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/pax/default.nix
@@ -0,0 +1,30 @@
+{ lib, stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  pname = "pax";
+  version = "20201030";
+
+  src = fetchurl {
+    url = "http://www.mirbsd.org/MirOS/dist/mir/cpio/paxmirabilis-${version}.tgz";
+    sha256 = "1p18nxijh323f4i1s2pg7pcr0557xljl5avv8ll5s9nfr34r5j0w";
+  };
+
+  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/pxattr/default.nix b/nixpkgs/pkgs/tools/archivers/pxattr/default.nix
new file mode 100644
index 000000000000..79a40e6ca6be
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/pxattr/default.nix
@@ -0,0 +1,25 @@
+{ lib, stdenv, fetchurl, gcc }:
+
+stdenv.mkDerivation {
+  name = "pxattr-2.1.0";
+
+  src = fetchurl {
+    url = "https://www.lesbonscomptes.com/pxattr/pxattr-2.1.0.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/default.nix b/nixpkgs/pkgs/tools/archivers/quickbms/default.nix
new file mode 100644
index 000000000000..7846f18a1740
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/quickbms/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, lib, fetchzip, bzip2, lzo, openssl, 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=";
+  };
+
+  buildInputs = [ bzip2 lzo openssl zlib ];
+
+  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; [ samuelgrf ];
+    platforms = platforms.linux;
+  };
+}
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..c251cfe0dc30
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/runzip/default.nix
@@ -0,0 +1,23 @@
+{ lib, stdenv, fetchFromGitHub, libzip, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  version = "1.4";
+  pname = "runzip";
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [ 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.linux;
+  };
+}
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..dd3fb8462889
--- /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 = "http://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..c785211e682f
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/sharutils/default.nix
@@ -0,0 +1,72 @@
+{ lib, stdenv, fetchurl, gettext, coreutils }:
+
+stdenv.mkDerivation rec {
+  name = "sharutils-4.15.2";
+
+  src = fetchurl {
+    url = "mirror://gnu/sharutils/${name}.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";
+    })
+  ];
+
+  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..f3a940068734
--- /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.4";
+
+  src = fetchFromGitHub {
+    owner = "kubo";
+    repo = "snzip";
+    rev = version;
+    sha256 = "1v8li1zv9f2g31iyi9y9zx42rjvwkaw221g60pmkbv53y667i325";
+  };
+
+  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/unar/default.nix b/nixpkgs/pkgs/tools/archivers/unar/default.nix
new file mode 100644
index 000000000000..f3f7b32e1192
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unar/default.nix
@@ -0,0 +1,66 @@
+{ lib, stdenv, fetchFromGitHub, installShellFiles, gnustep, bzip2, zlib, icu, openssl, wavpack }:
+
+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 = ''
+    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-nonfragile-abi"
+    done
+
+    # we need to build inside this directory as well, so we have to make it writeable
+    chmod +w ../UniversalDetector -R
+  '';
+
+  buildInputs = [ gnustep.base bzip2 icu openssl wavpack zlib ];
+
+  nativeBuildInputs = [ gnustep.make installShellFiles ];
+
+  enableParallelBuilding = true;
+
+  dontConfigure = true;
+
+  makefile = "Makefile.linux";
+
+  sourceRoot = "./source/XADMaster";
+
+  installPhase = ''
+    runHook preInstall
+
+    install -Dm555 -t $out/bin 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 ];
+    platforms = platforms.linux;
+  };
+}
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..c63ec008d678
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unp/default.nix
@@ -0,0 +1,45 @@
+{ 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-pre7";
+  nativeBuildInputs = [ makeWrapper ];
+  buildInputs = [ perl ];
+
+  src = fetchurl {
+    # url = "http://http.debian.net/debian/pool/main/u/unp/unp_2.0~pre7+nmu1.tar.bz2";
+    url = "mirror://debian/pool/main/u/unp/unp_2.0~pre7+nmu1.tar.bz2";
+    sha256 = "09w2sy7ivmylxf8blf0ywxicvb4pbl0xhrlbb3i9x9d56ll6ybbw";
+    name = "unp_2.0_pre7+nmu1.tar.bz2";
+  };
+
+  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/default.nix b/nixpkgs/pkgs/tools/archivers/unrar/default.nix
new file mode 100644
index 000000000000..b06242a98c04
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unrar/default.nix
@@ -0,0 +1,48 @@
+{lib, stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  pname = "unrar";
+  version = "5.9.2";
+
+  src = fetchurl {
+    url = "https://www.rarlab.com/rar/unrarsrc-${version}.tar.gz";
+    sha256 = "19nsxdvf9ll99hvgzq6f89ymxhwki224lygjdabrg8ghikqvmlvk";
+  };
+
+  postPatch = ''
+    substituteInPlace makefile \
+      --replace "CXX=" "#CXX=" \
+      --replace "STRIP=" "#STRIP=" \
+      --replace "AR=" "#AR="
+  '';
+
+  buildPhase = ''
+    make unrar
+    make clean
+    make lib
+  '';
+
+  outputs = [ "out" "dev" ];
+
+  installPhase = ''
+    install -Dt "$out/bin" unrar
+
+    mkdir -p $out/share/doc/unrar
+    cp acknow.txt license.txt \
+        $out/share/doc/unrar
+
+    install -Dm755 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..2c58b546b63c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unshield/default.nix
@@ -0,0 +1,24 @@
+{ lib, stdenv, fetchFromGitHub, cmake, zlib, openssl }:
+
+stdenv.mkDerivation rec {
+  pname = "unshield";
+  version = "1.4.3";
+
+  src = fetchFromGitHub {
+    owner = "twogood";
+    repo = "unshield";
+    rev = version;
+    sha256 = "19wn22vszhci8dfcixx5rliz7phx3lv5ablvhjlclvj75k2vsdqd";
+  };
+
+
+  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;
+  };
+}
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..e74637ca25ec
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unzip/default.nix
@@ -0,0 +1,80 @@
+{ lib, stdenv, fetchurl
+, bzip2
+, enableNLS ? false, libnatspec
+}:
+
+stdenv.mkDerivation {
+  name = "unzip-6.0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/infozip/unzip60.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";
+    })
+  ] ++ lib.optional enableNLS
+    (fetchurl {
+      url = "http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/app-arch/unzip/files/unzip-6.0-natspec.patch?revision=1.1";
+      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"
+  ];
+
+  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/setup-hook.sh b/nixpkgs/pkgs/tools/archivers/unzip/setup-hook.sh
new file mode 100644
index 000000000000..4055d2fab512
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/unzip/setup-hook.sh
@@ -0,0 +1,5 @@
+unpackCmdHooks+=(_tryUnzip)
+_tryUnzip() {
+    if ! [[ "$curSrc" =~ \.zip$ ]]; then return 1; fi
+    unzip -qq "$curSrc"
+}
diff --git a/nixpkgs/pkgs/tools/archivers/wimlib/default.nix b/nixpkgs/pkgs/tools/archivers/wimlib/default.nix
new file mode 100644
index 000000000000..4f397b9bf55f
--- /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.2";
+  pname = "wimlib";
+
+  nativeBuildInputs = [ pkg-config makeWrapper ];
+  buildInputs = [ openssl fuse libxml2 ntfs3g ];
+
+  src = fetchurl {
+    url = "https://wimlib.net/downloads/${pname}-${version}.tar.gz";
+    sha256 = "0id9ym3hzij4kpdrk0sz3ijxp5r0z1md5jch83pml9hdy1zbx5bj";
+  };
+
+  preBuild = ''
+    substituteInPlace programs/mkwinpeimg.in \
+      --replace '/usr/lib/syslinux' "${syslinux}/share/syslinux"
+  '';
+
+  postInstall = let
+    path = lib.makeBinPath  [ cabextract cdrkit mtools ntfs3g syslinux ];
+  in ''
+    for prog in $out/bin/*; do
+      wrapProgram $prog --prefix PATH : ${path}
+    done
+  '';
+
+  doCheck = true;
+
+  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; [ andir ];
+    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..57d35633128d
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/xarchiver/default.nix
@@ -0,0 +1,30 @@
+{ 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.17";
+  pname = "xarchiver";
+
+  src = fetchFromGitHub {
+    owner = "ib";
+    repo = "xarchiver";
+    rev = version;
+    sha256 = "00adrjpxqlaccrwjf65w3vhxfswdj0as8aj263c6f9b85llypc5v";
+  };
+
+  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 = {
+    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/xtrt/default.nix b/nixpkgs/pkgs/tools/archivers/xtrt/default.nix
new file mode 100644
index 000000000000..175494057e0a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/xtrt/default.nix
@@ -0,0 +1,36 @@
+{ bzip2, fetchFromGitHub, gzip, gnutar, lib, stdenv, unzip, xz }:
+
+stdenv.mkDerivation rec {
+  pname = "xtrt";
+  version = "unstable-2021-02-17";
+
+  src = fetchFromGitHub {
+    owner = "figsoda";
+    repo = pname;
+    rev = "61884fb7c48c7e1e2194afd82b85f415a6dc7c20";
+    sha256 = "073l4q6mx5if791p5a6w8m8bz2aypmjmycaijq4spql8bh6h12vf";
+  };
+
+  postPatch = ''
+    substituteInPlace xtrt \
+      --replace "bzip2 " "${bzip2}/bin/bzip2 " \
+      --replace "gzip " "${gzip}/bin/gzip " \
+      --replace "tar " "${gnutar}/bin/tar " \
+      --replace "unzip " "${unzip}/bin/unzip " \
+      --replace "xz " "${xz}/bin/xz "
+  '';
+
+  installPhase = ''
+    runHook preInstall
+    mkdir -p $out/bin
+    cp xtrt $out/bin
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    description = "Tiny script to extract archives by their extensions";
+    homepage = "https://github.com/figsoda/xtrt";
+    license = licenses.unlicense;
+    maintainers = with maintainers; [ figsoda ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/zip/default.nix b/nixpkgs/pkgs/tools/archivers/zip/default.nix
new file mode 100644
index 000000000000..58c748fe4e8a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/zip/default.nix
@@ -0,0 +1,40 @@
+{ lib, stdenv, fetchurl, enableNLS ? false, libnatspec ? null, libiconv }:
+
+assert enableNLS -> libnatspec != null;
+
+stdenv.mkDerivation {
+  name = "zip-3.0";
+
+  src = fetchurl {
+    urls = [
+      "ftp://ftp.info-zip.org/pub/infozip/src/zip30.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 = if (enableNLS && !stdenv.isCygwin) then [ ./natspec-gentoo.patch.bz2 ] else [];
+
+  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..150633e620ae
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/zpaq/default.nix
@@ -0,0 +1,36 @@
+{ 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 */ ];
+
+  preBuild = let
+    CPPFLAGS = with stdenv; ""
+      + (lib.optionalString (!isi686 && !isx86_64) "-DNOJIT ")
+      + "-Dunix";
+    CXXFLAGS = "-O3 -DNDEBUG";
+  in ''
+    buildFlagsArray=( "CPPFLAGS=${CPPFLAGS}" "CXXFLAGS=${CXXFLAGS}" )
+  '';
+
+  enableParallelBuilding = true;
+
+  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/default.upstream b/nixpkgs/pkgs/tools/archivers/zpaq/default.upstream
new file mode 100644
index 000000000000..84daee900cec
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/zpaq/default.upstream
@@ -0,0 +1,6 @@
+url http://mattmahoney.net/dc/zpaq.html
+version_link 'zpaq[0-9]+[.]zip'
+version "[^0-9]*([0-9]+)[^0-9]*" '\1'
+name zpaq
+attribute_name zpaq
+minimize_overwrite
diff --git a/nixpkgs/pkgs/tools/archivers/zpaq/zpaqd.nix b/nixpkgs/pkgs/tools/archivers/zpaq/zpaqd.nix
new file mode 100644
index 000000000000..c2f214ea2a62
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/zpaq/zpaqd.nix
@@ -0,0 +1,48 @@
+{ lib, stdenv, fetchurl, unzip }:
+
+let
+  # Generated upstream information
+  s = rec {
+    baseName="zpaqd";
+    version="715";
+    name="${baseName}-${version}";
+    hash="0868lynb45lm79yvx5f10lj5h6bfv0yck8whcls2j080vmk3n7rk";
+    url="http://mattmahoney.net/dc/zpaqd715.zip";
+    sha256="0868lynb45lm79yvx5f10lj5h6bfv0yck8whcls2j080vmk3n7rk";
+  };
+
+  compileFlags = lib.concatStringsSep " " ([ "-O3" "-DNDEBUG" ]
+    ++ lib.optional (stdenv.hostPlatform.isUnix) "-Dunix -pthread"
+    ++ lib.optional (!stdenv.hostPlatform.isx86) "-DNOJIT");
+in
+stdenv.mkDerivation {
+  inherit (s) name version;
+
+  src = fetchurl {
+    inherit (s) url sha256;
+  };
+
+  sourceRoot = ".";
+
+  nativeBuildInputs = [ unzip ];
+
+  buildPhase = ''
+    g++ ${compileFlags} -fPIC --shared libzpaq.cpp -o libzpaq.so
+    g++ ${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;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/archivers/zpaq/zpaqd.upstream b/nixpkgs/pkgs/tools/archivers/zpaq/zpaqd.upstream
new file mode 100644
index 000000000000..ef83c58e4600
--- /dev/null
+++ b/nixpkgs/pkgs/tools/archivers/zpaq/zpaqd.upstream
@@ -0,0 +1,5 @@
+url http://mattmahoney.net/dc/zpaqutil.html
+version_link 'zpaqd[0-9]+[.]zip'
+version "[^0-9]*([0-9]+)[^0-9]*" '\1'
+name zpaqd
+attribute_name zpaqd