about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/filesystems
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/filesystems')
-rw-r--r--nixpkgs/pkgs/tools/filesystems/9pfs/default.nix31
-rw-r--r--nixpkgs/pkgs/tools/filesystems/aefs/default.nix20
-rw-r--r--nixpkgs/pkgs/tools/filesystems/afpfs-ng/default.nix24
-rw-r--r--nixpkgs/pkgs/tools/filesystems/android-file-transfer/default.nix24
-rw-r--r--nixpkgs/pkgs/tools/filesystems/apfs-fuse/default.nix30
-rw-r--r--nixpkgs/pkgs/tools/filesystems/archivemount/default.nix22
-rw-r--r--nixpkgs/pkgs/tools/filesystems/avfs/default.nix26
-rw-r--r--nixpkgs/pkgs/tools/filesystems/bashmount/default.nix37
-rw-r--r--nixpkgs/pkgs/tools/filesystems/bcache-tools/bcache-udev-modern.patch52
-rw-r--r--nixpkgs/pkgs/tools/filesystems/bcache-tools/default.nix62
-rw-r--r--nixpkgs/pkgs/tools/filesystems/bcache-tools/fix-static.patch22
-rw-r--r--nixpkgs/pkgs/tools/filesystems/bcachefs-tools/default.nix49
-rwxr-xr-xnixpkgs/pkgs/tools/filesystems/bees/bees-service-wrapper227
-rw-r--r--nixpkgs/pkgs/tools/filesystems/bees/default.nix67
-rw-r--r--nixpkgs/pkgs/tools/filesystems/bindfs/default.nix27
-rw-r--r--nixpkgs/pkgs/tools/filesystems/blobfuse/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/filesystems/bonnie/default.nix20
-rw-r--r--nixpkgs/pkgs/tools/filesystems/boxfs/default.nix60
-rw-r--r--nixpkgs/pkgs/tools/filesystems/boxfs/work-around-API-borkage.patch15
-rw-r--r--nixpkgs/pkgs/tools/filesystems/btrfs-heatmap/default.nix46
-rw-r--r--nixpkgs/pkgs/tools/filesystems/btrfs-progs/default.nix41
-rw-r--r--nixpkgs/pkgs/tools/filesystems/buttersink/default.nix30
-rw-r--r--nixpkgs/pkgs/tools/filesystems/catcli/default.nix30
-rw-r--r--nixpkgs/pkgs/tools/filesystems/ceph/0000-fix-SPDK-build-env.patch11
-rw-r--r--nixpkgs/pkgs/tools/filesystems/ceph/ceph-glibc-2-32-sigdescr_np.patch63
-rw-r--r--nixpkgs/pkgs/tools/filesystems/ceph/default.nix220
-rw-r--r--nixpkgs/pkgs/tools/filesystems/chunkfs/default.nix30
-rw-r--r--nixpkgs/pkgs/tools/filesystems/ciopfs/default.nix22
-rw-r--r--nixpkgs/pkgs/tools/filesystems/convoy/default.nix26
-rw-r--r--nixpkgs/pkgs/tools/filesystems/cpcfs/default.nix41
-rw-r--r--nixpkgs/pkgs/tools/filesystems/cryfs/default.nix76
-rw-r--r--nixpkgs/pkgs/tools/filesystems/curlftpfs/default.nix21
-rw-r--r--nixpkgs/pkgs/tools/filesystems/darling-dmg/default.nix29
-rw-r--r--nixpkgs/pkgs/tools/filesystems/davfs2/0001-umount_davfs-substitute-ps-command.patch25
-rw-r--r--nixpkgs/pkgs/tools/filesystems/davfs2/0002-Make-sure-that-the-setuid-wrapped-umount-is-invoked.patch42
-rw-r--r--nixpkgs/pkgs/tools/filesystems/davfs2/default.nix55
-rw-r--r--nixpkgs/pkgs/tools/filesystems/davfs2/fix-sysconfdir.patch60
-rw-r--r--nixpkgs/pkgs/tools/filesystems/davfs2/isdir.patch30
-rw-r--r--nixpkgs/pkgs/tools/filesystems/dislocker/default.nix30
-rw-r--r--nixpkgs/pkgs/tools/filesystems/disorderfs/default.nix24
-rw-r--r--nixpkgs/pkgs/tools/filesystems/djmount/default.nix21
-rw-r--r--nixpkgs/pkgs/tools/filesystems/dosfstools/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/filesystems/duff/default.nix40
-rw-r--r--nixpkgs/pkgs/tools/filesystems/duperemove/default.nix27
-rw-r--r--nixpkgs/pkgs/tools/filesystems/e2fsprogs/default.nix75
-rw-r--r--nixpkgs/pkgs/tools/filesystems/e2tools/default.nix24
-rw-r--r--nixpkgs/pkgs/tools/filesystems/encfs/default.nix32
-rw-r--r--nixpkgs/pkgs/tools/filesystems/exfat/default.nix24
-rw-r--r--nixpkgs/pkgs/tools/filesystems/ext4magic/default.nix40
-rw-r--r--nixpkgs/pkgs/tools/filesystems/ext4magic/glibc-fix.patch12
-rw-r--r--nixpkgs/pkgs/tools/filesystems/extundelete/default.nix29
-rw-r--r--nixpkgs/pkgs/tools/filesystems/f2fs-tools/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/filesystems/f2fs-tools/f2fs-tools-cross-fix.patch29
-rw-r--r--nixpkgs/pkgs/tools/filesystems/f3/default.nix57
-rw-r--r--nixpkgs/pkgs/tools/filesystems/fatresize/default.nix26
-rw-r--r--nixpkgs/pkgs/tools/filesystems/fatsort/default.nix26
-rw-r--r--nixpkgs/pkgs/tools/filesystems/fatsort/fatsort-Makefiles.patch34
-rw-r--r--nixpkgs/pkgs/tools/filesystems/file-rename/default.nix32
-rw-r--r--nixpkgs/pkgs/tools/filesystems/fsfs/default.nix30
-rw-r--r--nixpkgs/pkgs/tools/filesystems/fuse-7z-ng/default.nix40
-rw-r--r--nixpkgs/pkgs/tools/filesystems/fuse-overlayfs/default.nix28
-rw-r--r--nixpkgs/pkgs/tools/filesystems/fuseiso/default.nix55
-rw-r--r--nixpkgs/pkgs/tools/filesystems/gcsfuse/default.nix32
-rw-r--r--nixpkgs/pkgs/tools/filesystems/genext2fs/default.nix24
-rw-r--r--nixpkgs/pkgs/tools/filesystems/genimage/default.nix30
-rw-r--r--nixpkgs/pkgs/tools/filesystems/genromfs/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/filesystems/gitfs/default.nix37
-rw-r--r--nixpkgs/pkgs/tools/filesystems/glusterfs/default.nix190
-rw-r--r--nixpkgs/pkgs/tools/filesystems/go-mtpfs/default.nix20
-rw-r--r--nixpkgs/pkgs/tools/filesystems/go-mtpfs/deps.nix30
-rw-r--r--nixpkgs/pkgs/tools/filesystems/gocryptfs/default.nix51
-rw-r--r--nixpkgs/pkgs/tools/filesystems/gpart/default.nix33
-rw-r--r--nixpkgs/pkgs/tools/filesystems/grive2/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/filesystems/hfsprogs/default.nix49
-rw-r--r--nixpkgs/pkgs/tools/filesystems/httpfs/default.nix35
-rw-r--r--nixpkgs/pkgs/tools/filesystems/hubicfuse/default.nix29
-rw-r--r--nixpkgs/pkgs/tools/filesystems/idsk/default.nix29
-rw-r--r--nixpkgs/pkgs/tools/filesystems/ifuse/default.nix29
-rw-r--r--nixpkgs/pkgs/tools/filesystems/irods/common.nix55
-rw-r--r--nixpkgs/pkgs/tools/filesystems/irods/default.nix99
-rw-r--r--nixpkgs/pkgs/tools/filesystems/irods/irods_root_path.patch71
-rw-r--r--nixpkgs/pkgs/tools/filesystems/irods/zmqcpp-deprecated-send_recv.patch21
-rw-r--r--nixpkgs/pkgs/tools/filesystems/jfsutils/ar-fix.patch10
-rw-r--r--nixpkgs/pkgs/tools/filesystems/jfsutils/default.nix33
-rw-r--r--nixpkgs/pkgs/tools/filesystems/jfsutils/hardening-format.patch37
-rw-r--r--nixpkgs/pkgs/tools/filesystems/jfsutils/types.patch12
-rw-r--r--nixpkgs/pkgs/tools/filesystems/jmtpfs/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/filesystems/lizardfs/default.nix49
-rw-r--r--nixpkgs/pkgs/tools/filesystems/mergerfs/default.nix41
-rw-r--r--nixpkgs/pkgs/tools/filesystems/mergerfs/tools.nix36
-rw-r--r--nixpkgs/pkgs/tools/filesystems/mhddfs/default.nix35
-rw-r--r--nixpkgs/pkgs/tools/filesystems/mhddfs/fix-format-security-error.patch12
-rw-r--r--nixpkgs/pkgs/tools/filesystems/mkspiffs/default.nix32
-rw-r--r--nixpkgs/pkgs/tools/filesystems/mkspiffs/presets.nix20
-rw-r--r--nixpkgs/pkgs/tools/filesystems/moosefs/default.nix38
-rw-r--r--nixpkgs/pkgs/tools/filesystems/mp3fs/default.nix32
-rw-r--r--nixpkgs/pkgs/tools/filesystems/mp3fs/fix-statfs-operation.patch39
-rw-r--r--nixpkgs/pkgs/tools/filesystems/mtdutils/default.nix30
-rw-r--r--nixpkgs/pkgs/tools/filesystems/mtools/UNUSED-darwin.patch11
-rw-r--r--nixpkgs/pkgs/tools/filesystems/mtools/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/filesystems/mtpfs/default.nix28
-rw-r--r--nixpkgs/pkgs/tools/filesystems/netatalk/default.nix61
-rw-r--r--nixpkgs/pkgs/tools/filesystems/netatalk/no-suid.patch11
-rw-r--r--nixpkgs/pkgs/tools/filesystems/netatalk/omitLocalstatedirCreation.patch19
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nilfs-utils/default.nix63
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/0.4/blivet.nix50
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/0.4/blivet.patch51
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/0.4/cryptsetup.nix38
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/0.4/default.nix77
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/0.4/dmraid.nix26
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/0.4/lvm2.nix76
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/0.4/multipath-tools.nix53
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/0.4/parted.nix61
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pyblock-sysmacros.h.patch12
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pyblock.nix36
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pykickstart.nix30
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pyparted.nix42
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/default.nix20
-rw-r--r--nixpkgs/pkgs/tools/filesystems/ntfs-3g/default.nix49
-rw-r--r--nixpkgs/pkgs/tools/filesystems/orangefs/default.nix61
-rw-r--r--nixpkgs/pkgs/tools/filesystems/rar2fs/default.nix39
-rw-r--r--nixpkgs/pkgs/tools/filesystems/rdfind/default.nix21
-rw-r--r--nixpkgs/pkgs/tools/filesystems/reiser4progs/default.nix32
-rw-r--r--nixpkgs/pkgs/tools/filesystems/reiserfsprogs/default.nix26
-rw-r--r--nixpkgs/pkgs/tools/filesystems/reiserfsprogs/reiserfsprogs-ar-fix.patch10
-rw-r--r--nixpkgs/pkgs/tools/filesystems/rmount/default.nix32
-rw-r--r--nixpkgs/pkgs/tools/filesystems/romdirfs/default.nix24
-rw-r--r--nixpkgs/pkgs/tools/filesystems/s3backer/default.nix30
-rw-r--r--nixpkgs/pkgs/tools/filesystems/s3fs/default.nix32
-rw-r--r--nixpkgs/pkgs/tools/filesystems/sandboxfs/Cargo.lock.patch640
-rw-r--r--nixpkgs/pkgs/tools/filesystems/sandboxfs/default.nix37
-rw-r--r--nixpkgs/pkgs/tools/filesystems/sasquatch/default.nix53
-rw-r--r--nixpkgs/pkgs/tools/filesystems/securefs/default.nix36
-rw-r--r--nixpkgs/pkgs/tools/filesystems/sftpman/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/filesystems/simg2img/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/filesystems/smbnetfs/default.nix28
-rw-r--r--nixpkgs/pkgs/tools/filesystems/smbnetfs/default.upstream6
-rw-r--r--nixpkgs/pkgs/tools/filesystems/snapraid/default.nix28
-rw-r--r--nixpkgs/pkgs/tools/filesystems/squashfs-tools-ng/default.nix24
-rw-r--r--nixpkgs/pkgs/tools/filesystems/squashfs/4k-align.patch98
-rw-r--r--nixpkgs/pkgs/tools/filesystems/squashfs/darwin.patch357
-rw-r--r--nixpkgs/pkgs/tools/filesystems/squashfs/default.nix39
-rw-r--r--nixpkgs/pkgs/tools/filesystems/squashfuse/default.nix32
-rw-r--r--nixpkgs/pkgs/tools/filesystems/sshfs-fuse/default.nix52
-rw-r--r--nixpkgs/pkgs/tools/filesystems/svnfs/default.nix28
-rw-r--r--nixpkgs/pkgs/tools/filesystems/tmsu/default.nix40
-rw-r--r--nixpkgs/pkgs/tools/filesystems/tmsu/deps.nix39
-rw-r--r--nixpkgs/pkgs/tools/filesystems/u3-tool/default.nix21
-rw-r--r--nixpkgs/pkgs/tools/filesystems/ubidump/default.nix40
-rw-r--r--nixpkgs/pkgs/tools/filesystems/udftools/default.nix42
-rw-r--r--nixpkgs/pkgs/tools/filesystems/unionfs-fuse/default.nix45
-rw-r--r--nixpkgs/pkgs/tools/filesystems/unionfs-fuse/prevent-kill-on-shutdown.patch14
-rw-r--r--nixpkgs/pkgs/tools/filesystems/vmfs-tools/default.nix39
-rw-r--r--nixpkgs/pkgs/tools/filesystems/wdfs/default.nix18
-rw-r--r--nixpkgs/pkgs/tools/filesystems/wiimms-iso-tools/default.nix37
-rw-r--r--nixpkgs/pkgs/tools/filesystems/wiimms-iso-tools/fix-paths.diff12
-rw-r--r--nixpkgs/pkgs/tools/filesystems/xfsprogs/default.nix55
-rw-r--r--nixpkgs/pkgs/tools/filesystems/xtreemfs/default.nix78
-rw-r--r--nixpkgs/pkgs/tools/filesystems/yandex-disk/default.nix65
-rw-r--r--nixpkgs/pkgs/tools/filesystems/zerofree/default.nix26
-rw-r--r--nixpkgs/pkgs/tools/filesystems/zfstools/default.nix41
-rw-r--r--nixpkgs/pkgs/tools/filesystems/zkfuse/default.nix38
162 files changed, 7222 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/filesystems/9pfs/default.nix b/nixpkgs/pkgs/tools/filesystems/9pfs/default.nix
new file mode 100644
index 000000000000..9664526761b9
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/9pfs/default.nix
@@ -0,0 +1,31 @@
+{ lib, stdenv, fetchFromGitHub, fuse }:
+
+stdenv.mkDerivation {
+  name = "9pfs-20150918";
+
+  src = fetchFromGitHub {
+    owner = "mischief";
+    repo = "9pfs";
+    rev = "7f4ca4cd750d650c1215b92ac3cc2a28041960e4";
+    sha256 = "007s2idsn6bspmfxv1qabj39ggkgvn6gwdbhczwn04lb4c6gh3xc";
+  };
+
+  preConfigure =
+    ''
+      substituteInPlace Makefile --replace '-g bin' ""
+      installFlagsArray+=(BIN=$out/bin MAN=$out/share/man/man1)
+      mkdir -p $out/bin $out/share/man/man1
+    '';
+
+  buildInputs = [ fuse ];
+
+  enableParallelBuilding = true;
+
+  meta = {
+    homepage = "https://github.com/mischief/9pfs";
+    description = "FUSE-based client of the 9P network filesystem protocol";
+    maintainers = [ lib.maintainers.eelco ];
+    platforms = lib.platforms.linux;
+    license = with lib.licenses; [ lpl-102 bsd2 ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/aefs/default.nix b/nixpkgs/pkgs/tools/filesystems/aefs/default.nix
new file mode 100644
index 000000000000..ed47b8f885bd
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/aefs/default.nix
@@ -0,0 +1,20 @@
+{ lib, stdenv, fetchurl, fuse }:
+
+stdenv.mkDerivation rec {
+  name = "aefs-0.4pre259-8843b7c";
+
+  src = fetchurl {
+    url = "http://tarballs.nixos.org/${name}.tar.bz2";
+    sha256 = "167hp58hmgdavg2mqn5dx1xgq24v08n8d6psf33jhbdabzx6a6zq";
+  };
+
+  buildInputs = [ fuse ];
+
+  meta = with lib; {
+    homepage = "https://github.com/edolstra/aefs";
+    description = "A cryptographic filesystem implemented in userspace using FUSE";
+    platforms = platforms.linux;
+    maintainers = [ maintainers.eelco ];
+    license = licenses.gpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/afpfs-ng/default.nix b/nixpkgs/pkgs/tools/filesystems/afpfs-ng/default.nix
new file mode 100644
index 000000000000..9c4268e402da
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/afpfs-ng/default.nix
@@ -0,0 +1,24 @@
+{ lib, stdenv, fetchFromGitHub, fuse, readline, libgcrypt, gmp }:
+
+stdenv.mkDerivation {
+  pname = "afpfs-ng";
+  version = "0.8.2";
+
+  src = fetchFromGitHub {
+    owner  = "simonvetter";
+    repo   = "afpfs-ng";
+    rev    = "f6e24eb73c9283732c3b5d9cb101a1e2e4fade3e";
+    sha256 = "125jx1rsqkiifcffyjb05b2s36rllckdgjaf1bay15k9gzhwwldz";
+  };
+
+  buildInputs = [ fuse readline libgcrypt gmp ];
+
+  meta = with lib; {
+    homepage    = "https://github.com/simonvetter/afpfs-ng";
+    description = "A client implementation of the Apple Filing Protocol";
+    license     = licenses.gpl2;
+    maintainers = with maintainers; [ rnhmjoj ];
+    platforms   = platforms.linux;
+  };
+
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/android-file-transfer/default.nix b/nixpkgs/pkgs/tools/filesystems/android-file-transfer/default.nix
new file mode 100644
index 000000000000..68199a0938eb
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/android-file-transfer/default.nix
@@ -0,0 +1,24 @@
+{ lib, stdenv, mkDerivation, fetchFromGitHub, cmake, fuse, readline, pkg-config, qtbase, qttools }:
+
+mkDerivation rec {
+  pname = "android-file-transfer";
+  version = "4.2";
+
+  src = fetchFromGitHub {
+    owner = "whoozle";
+    repo = "android-file-transfer-linux";
+    rev = "v${version}";
+    sha256 = "125rq8ji83nw6chfw43i0h9c38hjqh1qjibb0gnf9wrigar9zc8b";
+  };
+
+  nativeBuildInputs = [ cmake readline pkg-config ];
+  buildInputs = [ fuse qtbase qttools ];
+
+  meta = with lib; {
+    description = "Reliable MTP client with minimalistic UI";
+    homepage = "https://whoozle.github.io/android-file-transfer-linux/";
+    license = licenses.lgpl21Plus;
+    maintainers = [ maintainers.xaverdh ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/apfs-fuse/default.nix b/nixpkgs/pkgs/tools/filesystems/apfs-fuse/default.nix
new file mode 100644
index 000000000000..adf845f943ea
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/apfs-fuse/default.nix
@@ -0,0 +1,30 @@
+{ lib, stdenv, fetchFromGitHub, fuse3, bzip2, zlib, attr, cmake }:
+
+stdenv.mkDerivation {
+  pname = "apfs-fuse-unstable";
+  version = "2019-07-23";
+
+  src = fetchFromGitHub {
+    owner  = "sgan81";
+    repo   = "apfs-fuse";
+    rev    = "309ecb030f38edac4c10fa741a004c5eb7a23e15";
+    sha256 = "0wq6rlqi00m5dp5gbzy65i1plm40j6nsm7938zvfgx5laal4wzr2";
+    fetchSubmodules = true;
+  };
+
+  buildInputs = [ fuse3 bzip2 zlib attr ];
+  nativeBuildInputs = [ cmake ];
+
+  postFixup = ''
+    ln -s $out/bin/apfs-fuse $out/bin/mount.fuse.apfs-fuse
+  '';
+
+  meta = with lib; {
+    homepage    = "https://github.com/sgan81/apfs-fuse";
+    description = "FUSE driver for APFS (Apple File System)";
+    license     = licenses.gpl2;
+    maintainers = with maintainers; [ ealasu ];
+    platforms   = platforms.linux;
+  };
+
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/archivemount/default.nix b/nixpkgs/pkgs/tools/filesystems/archivemount/default.nix
new file mode 100644
index 000000000000..e3f9d8505fc4
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/archivemount/default.nix
@@ -0,0 +1,22 @@
+{ lib, stdenv, fetchurl, pkg-config, fuse, libarchive }:
+
+let
+  name = "archivemount-0.9.1";
+in
+stdenv.mkDerivation {
+  inherit name;
+
+  src = fetchurl {
+    url = "https://www.cybernoia.de/software/archivemount/${name}.tar.gz";
+    sha256 = "1cy5b6qril9c3ry6fv7ir87s8iyy5vxxmbyx90dm86fbra0vjaf5";
+  };
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ fuse libarchive ];
+
+  meta = {
+    description = "Gateway between FUSE and libarchive: allows mounting of cpio, .tar.gz, .tar.bz2 archives";
+    license = lib.licenses.gpl2;
+    platforms = lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/avfs/default.nix b/nixpkgs/pkgs/tools/filesystems/avfs/default.nix
new file mode 100644
index 000000000000..e89828dd7508
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/avfs/default.nix
@@ -0,0 +1,26 @@
+{ lib, stdenv, fetchurl, pkg-config, fuse, xz }:
+
+stdenv.mkDerivation rec {
+  pname = "avfs";
+  version = "1.1.3";
+  src = fetchurl {
+    url = "mirror://sourceforge/avf/${version}/${pname}-${version}.tar.bz2";
+    sha256 = "1psh8k7g7rb0gn7aygbjv86kxyi9xq07barxksa99nnmq3lc2kjg";
+  };
+
+  nativeBuildInputs = [ pkg-config ];
+
+  buildInputs = [ fuse xz ];
+
+  configureFlags = [
+    "--enable-library"
+    "--enable-fuse"
+  ];
+
+  meta = {
+    homepage = "http://avf.sourceforge.net/";
+    description = "Virtual filesystem that allows browsing of compressed files";
+    platforms = lib.platforms.linux;
+    license = lib.licenses.gpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/bashmount/default.nix b/nixpkgs/pkgs/tools/filesystems/bashmount/default.nix
new file mode 100644
index 000000000000..ef7bfd492e37
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/bashmount/default.nix
@@ -0,0 +1,37 @@
+{lib, stdenv, fetchFromGitHub}:
+
+stdenv.mkDerivation rec {
+  pname = "bashmount";
+  version = "4.3.2";
+
+  src = fetchFromGitHub {
+    owner = "jamielinux";
+    repo = "bashmount";
+    rev = version;
+    sha256 = "1irw47s6i1qwxd20cymzlfw5sv579cw877l27j3p66qfhgadwxrl";
+  };
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp bashmount $out/bin
+
+    mkdir -p $out/etc
+    cp bashmount.conf $out/etc
+
+    mkdir -p $out/share/man/man1
+    gzip -c -9 bashmount.1 > bashmount.1.gz
+    cp bashmount.1.gz $out/share/man/man1
+
+    mkdir -p $out/share/doc/bashmount
+    cp COPYING $out/share/doc/bashmount
+    cp NEWS    $out/share/doc/bashmount
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/jamielinux/bashmount";
+    description = "A menu-driven bash script for the management of removable media with udisks";
+    maintainers = [ maintainers.koral ];
+    license = licenses.gpl2;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/bcache-tools/bcache-udev-modern.patch b/nixpkgs/pkgs/tools/filesystems/bcache-tools/bcache-udev-modern.patch
new file mode 100644
index 000000000000..c6cf79785b73
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/bcache-tools/bcache-udev-modern.patch
@@ -0,0 +1,52 @@
+This patch does two things:
+1) Drops probe-bcache, so now new util-linux detecting functionality is used.
+2) Drops bcache-register, using kmod (built in udev) and moving registering device
+   into rule using 'sh'.
+This reduces things that need to be present in initrd, replacing them with already
+existing functionality and reducing overall initrd size.
+
+diff --git a/69-bcache.rules b/69-bcache.rules
+index 5d28e70..6a52893 100644
+--- a/69-bcache.rules
++++ b/69-bcache.rules
+@@ -10,15 +10,11 @@ KERNEL=="fd*|sr*", GOTO="bcache_end"
+ # It recognised bcache (util-linux 2.24+)
+ ENV{ID_FS_TYPE}=="bcache", GOTO="bcache_backing_found"
+ # It recognised something else; bail
+-ENV{ID_FS_TYPE}=="?*", GOTO="bcache_backing_end"
+-
+-# Backing devices: scan, symlink, register
+-IMPORT{program}="probe-bcache -o udev $tempnode"
+-ENV{ID_FS_TYPE}!="bcache", GOTO="bcache_backing_end"
+-ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
++GOTO="bcache_backing_end"
+ 
+ LABEL="bcache_backing_found"
+-RUN+="bcache-register $tempnode"
++RUN{builtin}+="kmod load bcache"
++RUN+="/bin/sh -c 'echo $tempnode > /sys/fs/bcache/register_quiet'"
+ LABEL="bcache_backing_end"
+ 
+ # Cached devices: symlink
+diff --git a/Makefile b/Makefile
+index 3f8d87b..15638a7 100644
+--- a/Makefile
++++ b/Makefile
+@@ -9,7 +9,7 @@ all: make-bcache probe-bcache bcache-super-show
+ 
+ install: make-bcache probe-bcache bcache-super-show
+ 	$(INSTALL) -m0755 make-bcache bcache-super-show	$(DESTDIR)${PREFIX}/sbin/
+-	$(INSTALL) -m0755 probe-bcache bcache-register		$(DESTDIR)$(UDEVLIBDIR)/
++#	$(INSTALL) -m0755 probe-bcache bcache-register		$(DESTDIR)$(UDEVLIBDIR)/
+ 	$(INSTALL) -m0644 69-bcache.rules	$(DESTDIR)$(UDEVLIBDIR)/rules.d/
+ 	$(INSTALL) -m0644 -- *.8 $(DESTDIR)${PREFIX}/share/man/man8/
+ 	$(INSTALL) -D -m0755 initramfs/hook	$(DESTDIR)/usr/share/initramfs-tools/hooks/bcache
+diff --git a/bcache-register b/bcache-register
+index 9b592bc..75b4faf 100755
+--- a/bcache-register
++++ b/bcache-register
+@@ -1,4 +1,3 @@
+ #!/bin/sh
+-/sbin/modprobe -qba bcache
+ test -f /sys/fs/bcache/register_quiet && echo "$1" > /sys/fs/bcache/register_quiet
+ 
diff --git a/nixpkgs/pkgs/tools/filesystems/bcache-tools/default.nix b/nixpkgs/pkgs/tools/filesystems/bcache-tools/default.nix
new file mode 100644
index 000000000000..ba6cb79fbd57
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/bcache-tools/default.nix
@@ -0,0 +1,62 @@
+{ lib, stdenv, fetchurl, pkg-config, util-linux, bash }:
+
+stdenv.mkDerivation rec {
+  pname = "bcache-tools";
+  version = "1.0.7";
+
+  src = fetchurl {
+    name = "${pname}-${version}.tar.gz";
+    url = "https://github.com/g2p/bcache-tools/archive/v${version}.tar.gz";
+    sha256 = "1gbsh2qw0a7kgck6w0apydiy37nnz5xvdgipa0yqrfmghl86vmv4";
+  };
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ util-linux ];
+
+  # * Remove broken install rules (they ignore $PREFIX) for stuff we don't need
+  #   anyway (it's distro specific stuff).
+  # * Fixup absolute path to modprobe.
+  prePatch = ''
+    sed -e "/INSTALL.*initramfs\/hook/d" \
+        -e "/INSTALL.*initcpio\/install/d" \
+        -e "/INSTALL.*dracut\/module-setup.sh/d" \
+        -e "s/pkg-config/$PKG_CONFIG/" \
+        -i Makefile
+  '';
+
+  patches = [
+    ./bcache-udev-modern.patch
+    ./fix-static.patch
+  ];
+
+  makeFlags = [
+    "PREFIX=${placeholder "out"}"
+    "UDEVLIBDIR=${placeholder "out"}/lib/udev/"
+  ];
+
+  preBuild = ''
+    sed -e "s|/bin/sh|${bash}/bin/sh|" -i *.rules
+  '';
+
+  preInstall = ''
+    mkdir -p "$out/sbin" "$out/lib/udev/rules.d" "$out/share/man/man8"
+  '';
+
+  meta = with lib; {
+    description = "User-space tools required for bcache (Linux block layer cache)";
+    longDescription = ''
+      Bcache is a Linux kernel block layer cache. It allows one or more fast
+      disk drives such as flash-based solid state drives (SSDs) to act as a
+      cache for one or more slower hard disk drives.
+
+      This package contains the required user-space tools.
+
+      User documentation is in Documentation/bcache.txt in the Linux kernel
+      tree.
+    '';
+    homepage = "https://bcache.evilpiepirate.org/";
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/bcache-tools/fix-static.patch b/nixpkgs/pkgs/tools/filesystems/bcache-tools/fix-static.patch
new file mode 100644
index 000000000000..e5dd2df5299d
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/bcache-tools/fix-static.patch
@@ -0,0 +1,22 @@
+diff --git a/bcache.c b/bcache.c
+index 8f37445..79806d8 100644
+--- a/bcache.c
++++ b/bcache.c
+@@ -26,7 +26,7 @@
+  * x^7 + x^4 + x + 1
+ */
+ 
+-static const uint64_t crc_table[256] = {
++const uint64_t crc_table[256] = {
+ 	0x0000000000000000ULL, 0x42F0E1EBA9EA3693ULL, 0x85E1C3D753D46D26ULL,
+ 	0xC711223CFA3E5BB5ULL, 0x493366450E42ECDFULL, 0x0BC387AEA7A8DA4CULL,
+ 	0xCCD2A5925D9681F9ULL, 0x8E224479F47CB76AULL, 0x9266CC8A1C85D9BEULL,
+@@ -115,7 +115,7 @@ static const uint64_t crc_table[256] = {
+ 	0x9AFCE626CE85B507ULL
+ };
+ 
+-inline uint64_t crc64(const void *_data, size_t len)
++uint64_t crc64(const void *_data, size_t len)
+ {
+ 	uint64_t crc = 0xFFFFFFFFFFFFFFFFULL;
+ 	const unsigned char *data = _data;
diff --git a/nixpkgs/pkgs/tools/filesystems/bcachefs-tools/default.nix b/nixpkgs/pkgs/tools/filesystems/bcachefs-tools/default.nix
new file mode 100644
index 000000000000..8ab82b672265
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/bcachefs-tools/default.nix
@@ -0,0 +1,49 @@
+{ lib, stdenv, fetchFromGitHub, pkg-config, attr, libuuid, libscrypt, libsodium, keyutils
+, liburcu, zlib, libaio, udev, zstd, lz4, valgrind, python3Packages
+, fuseSupport ? false, fuse3 ? null }:
+
+assert fuseSupport -> fuse3 != null;
+
+stdenv.mkDerivation {
+  pname = "bcachefs-tools";
+  version = "2020-11-17";
+
+  src = fetchFromGitHub {
+    owner = "koverstreet";
+    repo = "bcachefs-tools";
+    rev = "41bec63b265a38dd9fa168b6042ea5bf07135048";
+    sha256 = "1y3187kpw1bmnl97isv28k2sw8cmrnsn31a0dw745adwm0n7z6fj";
+  };
+
+  postPatch = ''
+    substituteInPlace Makefile \
+      --replace "pytest-3" "pytest --verbose" \
+      --replace "INITRAMFS_DIR=/etc/initramfs-tools" \
+                "INITRAMFS_DIR=${placeholder "out"}/etc/initramfs-tools"
+  '';
+
+  nativeBuildInputs = [ pkg-config ];
+
+  buildInputs = [
+    libuuid libscrypt libsodium keyutils liburcu zlib libaio
+    zstd lz4 python3Packages.pytest udev valgrind
+  ] ++ lib.optional fuseSupport fuse3;
+
+  doCheck = false; # needs bcachefs module loaded on builder
+  checkFlags = [ "BCACHEFS_TEST_USE_VALGRIND=no" ];
+  checkInputs = [ valgrind ];
+
+  preCheck = lib.optionalString fuseSupport ''
+    rm tests/test_fuse.py
+  '';
+
+  installFlags = [ "PREFIX=${placeholder "out"}" ];
+
+  meta = with lib; {
+    description = "Tool for managing bcachefs filesystems";
+    homepage = "https://bcachefs.org/";
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ davidak chiiruno ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/bees/bees-service-wrapper b/nixpkgs/pkgs/tools/filesystems/bees/bees-service-wrapper
new file mode 100755
index 000000000000..67c95e8f8031
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/bees/bees-service-wrapper
@@ -0,0 +1,227 @@
+#!@bash@/bin/bash
+PATH=@bash@/bin:@coreutils@/bin:@utillinux@/bin:@btrfsProgs@/bin:$PATH
+beesd_bin=@bees@/lib/bees/bees
+# PLEASE KEEP NIX-ISMS ABOVE THIS LINE TO EASE UPSTREAM MERGE
+#!/usr/bin/env bash
+
+shopt -s extglob
+
+# Upstream wrapper requires UUID to be used for configuration.
+
+# However, when declaratively describing a host, we may not know its UUID, and
+# shouldn't need to persist something that will differ between hosts built from
+# the same configuration template.
+
+# Thus, for using bees from NixOS, we have our own wrapper, which supports not
+# just UUID but any specification permitted by findmnt
+
+[[ $bees_debug ]] && { PS4=':${BASH_SOURCE##*/}:$LINENO+'; set -x; }
+
+usage() {
+  cat >&2 <<EOF
+Usage: ${BASH_SOURCE##*/} run|cleanup config-name|fsSpec [idxSizeMB=...] [verbosity=...] [workDir=...] [-- daemon-options...]
+
+  fsSpec should be in a format recognized by findmnt. Alternately,
+  "config-name" may refer to a file that exists in ${bees_config_dir:-/etc/bees}
+  with a .conf extension; if that file does not specify UUID, findmnt will be
+  used in addition.
+
+  Note that while config files may presently use shell arithmetic, use of this
+  functionality is not encouraged going forward: Setting ''idxSizeMB=4096'' is
+  preferred over ''DB_SIZE=$((1024*1024*1024*4))'' or ''DB_SIZE=$(( AL16M * 256 ))'',
+  although both of these are presently supported.
+
+  If fsSpec contains a /, it assumed to be a mount point to be looked up by
+  findmnt, not a config file name.
+
+  daemon-options are passed directly through to the daemon on startup, as
+  documented at https://github.com/Zygo/bees/blob/master/docs/options.md.
+EOF
+  exit 1
+}
+
+die() { echo "$*" >&2; exit 1; }
+
+allConfigNames=( blockdev fsSpec home idxSize idxSizeMB mntDir runDir status verbosity workDir )
+
+# Alternate names for configuration values; "bees_" will always be prepended
+declare -A altConfigNames=(
+  # from original bees wrapper
+  [BEESHOME]=home
+  [BEESSTATUS]=status
+  [MNT_DIR]=mntDir
+  [UUID]=uuid
+  [WORK_DIR]=runDir
+  [DB_SIZE]=idxSize
+)
+
+# legacy bees config files can be arbitrary shell scripts, so we need to actually evaluate them
+sandboxedConfigFileEval() {
+  bash_exe=$(type -P bash) || exit
+  PATH=/var/empty ENV='' BASH_ENV='' AL128K="$((128*1024))" AL16M="$((16*1024*1024))" "$bash_exe" -r ${bees_debug+-x} \
+    -c 'eval "$(</dev/stdin)" >&2; for var; do [[ ${!var} ]] && printf "%q=%s\\0" "$var" "${!var}"; done' \
+    "${!altConfigNames[@]}" "${allConfigNames[@]}" \
+    <"$1"
+}
+
+readConfigFileIfExists() {
+  local line
+  [[ -s $1 ]] || return 1
+  while IFS= read -r -d '' line; do
+    line=${line%%+([[:space:]])"#"*}
+    [[ $line ]] || continue
+    [[ $line = *=* ]] || {
+      printf 'WARNING: Config file line not recognized: %q\n' "$line" >&2
+      continue
+    }
+    set_option "$line"
+  done < <(sandboxedConfigFileEval "$1")
+}
+
+set_option() {
+  local k v
+  k="${1%%=*}" v="${1#*=}"
+  [[ ${altConfigNames[$k]} ]] && k=${altConfigNames[$k]}
+  printf -v "bees_$k" %s "$v"
+}
+
+uuid_re='^[[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}$'
+
+# Shared code for setting configuration used by other operations.
+#
+# Reads from global associative array "opts" containing options passed in as
+# key=value pairs on the command line, looks for config-file overrides, and
+# sets individual global variables.
+_setup() {
+  declare fstype
+  bees_fsSpec=$1; shift
+
+  # Look for file-based configuration, additional to honoring configuration on the command line
+  bees_config_dir="${bees_config_dir:-/etc/bees}"
+  if [[ $bees_fsSpec =~ $uuid_re ]]; then
+    bees_uuid=$bees_fsSpec
+    # If our spec looks like a bare UUID, and no config file exists in the new
+    # format, fall back to legacy config file search mechanism (grep; ewww).
+    if ! readConfigFileIfExists "$bees_config_dir/UUID=$bees_fsSpec.conf"; then
+      # Legacy approach to finding a config file: Grep for a *.conf file
+      # containing the UUID within its text. Permitting spaces around the "="
+      # appears to be a bug, but is retained for compatibility with the
+      # original upstream script.
+      allConfFiles=( "$bees_config_dir"/*.conf )
+      if (( ${#allConfFiles[@]} )); then
+        # in read or readarray with -d '', the NUL terminating the empty string is used as delimiter character.
+        readarray -d '' -t matchingConfFiles < <(grep -E -l -Z "^[^#]*UUID[[:space:]]*=[[:space:]]*" "${allConfFiles[@]}")
+      else
+        matchingConfFiles=( )
+      fi
+      if (( ${#matchingConfFiles[@]} == 1 )); then
+        # Exactly one configuration file exists in our target directory with a reference to the UUID given.
+        bees_config_file=${matchingConfFiles[0]}
+        readConfigFileIfExists "$bees_config_file"
+        echo "NOTE: Please consider renaming $bees_config_file to $bees_config_dir/UUID=$bees_fsSpec" >&2
+        echo "      ...and passing UUID=$bees_fsSpec on startup." >&2
+      elif (( ${#matchingConfFiles[@]} > 1 )); then
+        # The legacy wrapper would silently use the first file and ignore
+        # others, but... no.
+        echo "ERROR: Passed a bare UUID, but multiple configuration files match it:" >&2
+        printf ' - %q\n' "${matchingConfFiles[@]}" >&2
+        die "Unable to continue."
+      fi
+    fi
+  else
+    # For a non-UUID fsSpec that is not a path, look only for a config file
+    # exactly matching its text.
+    #
+    # (Passing a mount point as a fsSpec is only supported with the new
+    # wrapper; all key=value pairs can be passed on the command line in this
+    # mode, so config file support is not needed).
+    [[ $bees_fsSpec = */* ]] || readConfigFileIfExists "$bees_config_dir/$bees_fsSpec.conf"
+  fi
+
+  [[ $bees_uuid ]] || {
+    # if bees_uuid is not in our .conf file, look it up with findmnt
+    for findmnt_mode in --kernel --mtab --fstab; do
+      read -r bees_uuid fstype < <(findmnt "$findmnt_mode" -n -o uuid,fstype "$bees_fsSpec") ||:
+      [[ $bees_uuid && $fstype ]] && break
+    done
+    [[ $bees_uuid ]] || die "Unable to identify a device matching $bees_fsSpec with findmnt"
+    [[ $fstype = btrfs ]] || die "Device type is $fstype, not btrfs"
+  }
+
+  [[ $bees_uuid = */* ]] || readConfigFileIfExists "$bees_config_dir/UUID=$bees_uuid.conf"
+
+  # Honor any values read from config files above; otherwise, set defaults.
+  bees_workDir="${bees_workDir:-.beeshome}"
+  bees_runDir="${bees_runDir:-/run/bees}"
+  bees_mntDir="${bees_mntDir:-$bees_runDir/mnt/$bees_uuid}"
+  bees_home="${bees_home:-$bees_mntDir/$bees_workDir}"
+  bees_status="${bees_status:-${bees_runDir}/$bees_uuid.status}"
+  bees_verbosity="${bees_verbosity:-6}"
+  bees_idxSizeMB="${bees_idxSizeMB:-1024}"
+  bees_idxSize=${bees_idxSize:-"$(( bees_idxSizeMB * 1024 * 1024 ))"}
+  bees_blockdev=${bees_blockdev:-"/dev/disk/by-uuid/$bees_uuid"}
+
+  [[ -b $bees_blockdev ]] || die "Block device $bees_blockdev missing"
+  (( bees_idxSize % (16 * 1024 * 1024) == 0 )) || die "DB size must be divisible by 16MB"
+}
+
+do_run() {
+  local db old_db_size
+
+  _setup "$1"; shift
+  mkdir -p -- "$bees_mntDir" || exit
+
+  # subvol id 5 is reserved for the root subvolume of a btrfs filesystem.
+  mountpoint -q "$bees_mntDir" || mount -osubvolid=5 -- "$bees_blockdev" "$bees_mntDir" || exit
+  if [[ -d $bees_home ]]; then
+    btrfs subvolume show "$bees_home" >/dev/null 2>&1 || die "$bees_home exists but is not a subvolume"
+  else
+    btrfs subvolume create "$bees_home" || exit
+    sync # workaround for Zygo/bees#93
+  fi
+  db=$bees_home/beeshash.dat
+  touch -- "$db"
+
+  old_db_size=$(stat -c %s -- "$db")
+  new_db_size=$bees_idxSize
+
+  if (( old_db_size != new_db_size )); then
+    rm -f -- "$bees_home"/beescrawl."$bees_uuid".dat
+    truncate -s "$new_db_size" -- "$db" || exit
+  fi
+  chmod 700 -- "$bees_home"
+
+  # BEESSTATUS and BEESHOME are the only variables handled by the legacy
+  # wrapper for which getenv() is called in C code.
+  BEESSTATUS=$bees_status BEESHOME=$bees_home exec "${beesd_bin:-/lib/bees/bees}" \
+    --verbose "$bees_verbosity" \
+    "$@" "$bees_mntDir" || exit
+}
+
+do_cleanup() {
+  _setup "$1"; shift
+  mountpoint -q "$bees_mntDir" && umount -l -- "$bees_mntDir" || exit
+}
+
+(( $# >= 2 )) || usage
+declare -f "do_$1" >/dev/null 2>&1 || usage
+mode=$1; shift # must be a do_* function; currently "run" or "cleanup"
+
+declare -a args=( "$1" ); shift  # pass first argument (config-name|fsSpec) through literally
+
+# parse other arguments as key=value pairs, or pass them through literally if they do not match that form.
+# similarly, any option after "--" will be passed through literally.
+while (( $# )); do
+  if [[ $1 = *=* ]]; then
+    set_option "$1"
+  elif [[ $1 = -- ]]; then
+    shift
+    args+=( "$@" )
+    break
+  else
+    args+=( "$1" )
+  fi
+  shift
+done
+
+"do_$mode" "${args[@]}"
diff --git a/nixpkgs/pkgs/tools/filesystems/bees/default.nix b/nixpkgs/pkgs/tools/filesystems/bees/default.nix
new file mode 100644
index 000000000000..bbad83f01768
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/bees/default.nix
@@ -0,0 +1,67 @@
+{ lib, stdenv, runCommand, fetchFromGitHub, bash, btrfs-progs, coreutils, python3Packages, util-linux }:
+
+let
+
+  bees = stdenv.mkDerivation rec {
+    pname = "bees";
+    version = "0.6.3";
+
+    src = fetchFromGitHub {
+      owner = "Zygo";
+      repo = "bees";
+      rev = "v${version}";
+      sha256 = "sha256-brEjr7lhmKDCIDeLq+XP+ZTxv1RvwoUlszMSEYygxv8=";
+    };
+
+    buildInputs = [
+      btrfs-progs               # for btrfs/ioctl.h
+      util-linux                 # for uuid.h
+    ];
+
+    nativeBuildInputs = [
+      python3Packages.markdown   # documentation build
+    ];
+
+    preBuild = ''
+      git() { if [[ $1 = describe ]]; then echo ${version}; else command git "$@"; fi; }
+      export -f git
+    '';
+
+    postBuild = ''
+      unset -f git
+    '';
+
+    buildFlags = [
+      "ETC_PREFIX=/var/run/bees/configs"
+    ];
+
+    makeFlags = [
+      "SHELL=bash"
+      "PREFIX=$(out)"
+      "ETC_PREFIX=$(out)/etc"
+      "BEES_VERSION=${version}"
+      "SYSTEMD_SYSTEM_UNIT_DIR=$(out)/etc/systemd/system"
+    ];
+
+    meta = with lib; {
+      homepage = "https://github.com/Zygo/bees";
+      description = "Block-oriented BTRFS deduplication service";
+      license = licenses.gpl3;
+      platforms = platforms.linux;
+      maintainers = with maintainers; [ chaduffy ];
+      longDescription = "Best-Effort Extent-Same: bees finds not just identical files, but also identical extents within files that differ";
+    };
+  };
+
+in
+
+runCommand "bees-service" {
+  inherit bash bees coreutils;
+  utillinux = util-linux; # needs to be a valid shell variable name
+  btrfsProgs = btrfs-progs; # needs to be a valid shell variable name
+} ''
+  mkdir -p -- "$out/bin"
+  substituteAll ${./bees-service-wrapper} "$out"/bin/bees-service-wrapper
+  chmod +x "$out"/bin/bees-service-wrapper
+  ln -s ${bees}/bin/beesd "$out"/bin/beesd
+''
diff --git a/nixpkgs/pkgs/tools/filesystems/bindfs/default.nix b/nixpkgs/pkgs/tools/filesystems/bindfs/default.nix
new file mode 100644
index 000000000000..a8baeaf3ef55
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/bindfs/default.nix
@@ -0,0 +1,27 @@
+{ lib, stdenv, fetchurl, fuse, pkg-config }:
+
+stdenv.mkDerivation rec {
+  version = "1.14.8";
+  pname = "bindfs";
+
+  src = fetchurl {
+    url    = "https://bindfs.org/downloads/${pname}-${version}.tar.gz";
+    sha256 = "15y4brlcrqhxl6z73785m0dr1vp2q3wc6xss08x9jjr0apzmmjp5";
+  };
+
+  dontStrip = true;
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ fuse ];
+  postFixup = ''
+    ln -s $out/bin/bindfs $out/bin/mount.fuse.bindfs
+  '';
+
+  meta = {
+    description = "A FUSE filesystem for mounting a directory to another location";
+    homepage    = "https://bindfs.org";
+    license     = lib.licenses.gpl2;
+    maintainers = with lib.maintainers; [ lovek323 ];
+    platforms   = lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/blobfuse/default.nix b/nixpkgs/pkgs/tools/filesystems/blobfuse/default.nix
new file mode 100644
index 000000000000..651e93f42137
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/blobfuse/default.nix
@@ -0,0 +1,25 @@
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, curl, gnutls, libgcrypt, libuuid, fuse }:
+
+stdenv.mkDerivation rec {
+  pname = "blobfuse";
+  version = "1.0.2";
+
+  src = fetchFromGitHub {
+    owner  = "Azure";
+    repo   = "azure-storage-fuse";
+    rev    = "v${version}";
+    sha256 = "1qh04z1fsj1l6l12sz9yl2sy9hwlrnzac54hwrr7wvsgv90n9gbp";
+  };
+
+  NIX_CFLAGS_COMPILE = "-Wno-error=catch-value";
+
+  buildInputs = [ curl gnutls libgcrypt libuuid fuse ];
+  nativeBuildInputs = [ cmake pkg-config ];
+
+  meta = with lib; {
+    description = "Mount an Azure Blob storage as filesystem through FUSE";
+    license = licenses.mit;
+    maintainers = with maintainers; [ jbgi ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/bonnie/default.nix b/nixpkgs/pkgs/tools/filesystems/bonnie/default.nix
new file mode 100644
index 000000000000..e34e5289ad64
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/bonnie/default.nix
@@ -0,0 +1,20 @@
+{ lib, stdenv, fetchurl, perl }:
+
+stdenv.mkDerivation rec {
+  name = "bonnie++-1.98";
+  src = fetchurl {
+    url = "https://www.coker.com.au/bonnie++/${name}.tgz";
+    sha256 = "010bmlmi0nrlp3aq7p624sfaj5a65lswnyyxk3cnz1bqig0cn2vf";
+  };
+
+  enableParallelBuilding = true;
+
+  buildInputs = [ perl ];
+
+  meta = {
+    homepage = "http://www.coker.com.au/bonnie++/";
+    description = "Hard drive and file system benchmark suite";
+    license = lib.licenses.gpl2;
+    platforms = lib.platforms.linux ++ lib.platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/boxfs/default.nix b/nixpkgs/pkgs/tools/filesystems/boxfs/default.nix
new file mode 100644
index 000000000000..5637b9af291a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/boxfs/default.nix
@@ -0,0 +1,60 @@
+{ lib, stdenv, fetchFromGitHub, curl, fuse, libxml2, pkg-config }:
+
+let
+  srcs = {
+    boxfs2 = fetchFromGitHub {
+      sha256 = "10af1l3sjnh25shmq5gdnpyqk4vrq7i1zklv4csf1n2nrahln8j8";
+      rev = "d7018b0546d2dae956ae3da3fb95d2f63fa6d3ff";
+      repo = "boxfs2";
+      owner = "drotiro";
+    };
+    libapp = fetchFromGitHub {
+      sha256 = "1p2sbxiranan2n2xsfjkp3c6r2vcs57ds6qvjv4crs1yhxr7cp00";
+      rev = "febebe2bc0fb88d57bdf4eb4a2a54c9eeda3f3d8";
+      repo = "libapp";
+      owner = "drotiro";
+    };
+    libjson = fetchFromGitHub {
+      sha256 = "1vhss3gq44nl61fbnh1l3qzwvz623gwhfgykf1lf1p31rjr7273w";
+      rev = "75a7f50fca2c667bc5f32cdd6dd98f2b673f6657";
+      repo = "libjson";
+      owner = "vincenthz";
+    };
+  };
+in stdenv.mkDerivation {
+  pname = "boxfs";
+  version = "2-20150109";
+
+  src = srcs.boxfs2;
+
+  prePatch = with srcs; ''
+    substituteInPlace Makefile --replace "git pull" "true"
+    cp -a --no-preserve=mode ${libapp} libapp
+    cp -a --no-preserve=mode ${libjson} libjson
+  '';
+  patches = [ ./work-around-API-borkage.patch ];
+
+  buildInputs = [ curl fuse libxml2 ];
+  nativeBuildInputs = [ pkg-config ];
+
+  buildFlags = [ "static" ];
+
+  installPhase = ''
+    mkdir -p $out/bin
+    install boxfs boxfs-init $out/bin
+  '';
+
+  meta = with lib; {
+    description = "FUSE file system for box.com accounts";
+    longDescription = ''
+      Store files on box.com (an account is required). The first time you run
+      boxfs, you will need to complete the authentication (oauth2) process and
+      grant access to your box.com account. Just follow the instructions on
+      the terminal and in your browser. When you've done using your files,
+      unmount the file system with `fusermount -u mountpoint`.
+    '';
+    homepage = "https://github.com/drotiro/boxfs2";
+    license = licenses.gpl3;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/boxfs/work-around-API-borkage.patch b/nixpkgs/pkgs/tools/filesystems/boxfs/work-around-API-borkage.patch
new file mode 100644
index 000000000000..b74e7f324665
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/boxfs/work-around-API-borkage.patch
@@ -0,0 +1,15 @@
+diff --git a/boxapi.c b/boxapi.c
+index 4964273..1a32e0d 100644
+--- a/boxapi.c
++++ b/boxapi.c
+@@ -38,8 +38,8 @@
+ //    AUTH
+ #define API_KEY_VAL "f9ss11y2w0hg5r04jsidxlhk4pil28cf"
+ #define API_SECRET  "r3ZHAIhsOL2FoHjgERI9xf74W5skIM0w"
+-#define API_OAUTH_URL "https://app.box.com/api/oauth2/" //"https://www.box.com/api/oauth2/"
+-#define API_OAUTH_AUTHORIZE API_OAUTH_URL "authorize?response_type=code&client_id=" API_KEY_VAL /*"&redirect_uri=http%3A//localhost"*/
++#define API_OAUTH_URL "https://api.box.com/oauth2/" //"https://www.box.com/api/oauth2/"
++#define API_OAUTH_AUTHORIZE "https://app.box.com/api/oauth2/authorize?response_type=code&client_id=" API_KEY_VAL /*"&redirect_uri=http%3A//localhost"*/
+ #define API_OAUTH_TOKEN     API_OAUTH_URL "token"
+ //    CALLS
+ #define API_ENDPOINT	"https://api.box.com/2.0/"
diff --git a/nixpkgs/pkgs/tools/filesystems/btrfs-heatmap/default.nix b/nixpkgs/pkgs/tools/filesystems/btrfs-heatmap/default.nix
new file mode 100644
index 000000000000..04d74d78cfde
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/btrfs-heatmap/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, lib
+, fetchFromGitHub
+, python3
+, installShellFiles
+, fetchurl
+}:
+
+stdenv.mkDerivation rec {
+  pname = "btrfs-heatmap";
+  version = "8";
+
+  src = fetchFromGitHub {
+    owner = "knorrie";
+    repo = "btrfs-heatmap";
+    rev = "v${version}";
+    sha256 = "035frvk3s7g18y81srssvm550nfq7jylr7w60nvixidxvrc0yrnh";
+  };
+
+  # man page is currently only in the debian branch
+  # https://github.com/knorrie/btrfs-heatmap/issues/11
+  msrc = fetchurl {
+    url = "https://raw.githubusercontent.com/knorrie/btrfs-heatmap/45d844e12d7f5842ebb99e65d7b968a5e1a89066/debian/man/btrfs-heatmap.8";
+    sha256 = "1md7xc426sc8lq4w29gjd6gv7vjqhcwrqqcr6z39kihvi04d5f6q";
+  };
+
+  buildInputs = [ python3 ];
+  nativeBuildInputs = [ python3.pkgs.wrapPython installShellFiles ];
+
+  outputs = [ "out" "man" ];
+
+  installPhase = ''
+    install -Dm 0755 heatmap.py $out/sbin/btrfs-heatmap
+    installManPage ${msrc}
+
+    buildPythonPath ${python3.pkgs.btrfs}
+    patchPythonScript $out/sbin/btrfs-heatmap
+  '';
+
+  meta = with lib; {
+    description = "Visualize the layout of a mounted btrfs";
+    homepage = "https://github.com/knorrie/btrfs-heatmap";
+    license = licenses.mit;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.evils ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/btrfs-progs/default.nix b/nixpkgs/pkgs/tools/filesystems/btrfs-progs/default.nix
new file mode 100644
index 000000000000..84ceea384c3a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/btrfs-progs/default.nix
@@ -0,0 +1,41 @@
+{ lib, stdenv, fetchurl, pkg-config, attr, acl, zlib, libuuid, e2fsprogs, lzo
+, asciidoc, xmlto, docbook_xml_dtd_45, docbook_xsl, libxslt, zstd, python3
+}:
+
+stdenv.mkDerivation rec {
+  pname = "btrfs-progs";
+  version = "5.9";
+
+  src = fetchurl {
+    url = "mirror://kernel/linux/kernel/people/kdave/btrfs-progs/btrfs-progs-v${version}.tar.xz";
+    sha256 = "14d7hz07kfczfgmy1ixkgccjn393gpkjn7givz5kwxddcnk5i4xq";
+  };
+
+  nativeBuildInputs = [
+    pkg-config asciidoc xmlto docbook_xml_dtd_45 docbook_xsl libxslt
+    python3 python3.pkgs.setuptools
+  ];
+
+  buildInputs = [ attr acl zlib libuuid e2fsprogs lzo zstd python3 ];
+
+  # for python cross-compiling
+  _PYTHON_HOST_PLATFORM = stdenv.hostPlatform.config;
+
+  # gcc bug with -O1 on ARM with gcc 4.8
+  # This should be fine on all platforms so apply universally
+  postPatch = "sed -i s/-O1/-O2/ configure";
+
+  postInstall = ''
+    install -v -m 444 -D btrfs-completion $out/share/bash-completion/completions/btrfs
+  '';
+
+  configureFlags = lib.optional stdenv.hostPlatform.isMusl "--disable-backtrace";
+
+  meta = with lib; {
+    description = "Utilities for the btrfs filesystem";
+    homepage = "https://btrfs.wiki.kernel.org/";
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ raskin ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/buttersink/default.nix b/nixpkgs/pkgs/tools/filesystems/buttersink/default.nix
new file mode 100644
index 000000000000..aa0f317787f8
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/buttersink/default.nix
@@ -0,0 +1,30 @@
+{ lib, python2 }:
+
+python2.pkgs.buildPythonApplication rec {
+  pname = "buttersink";
+  version = "0.6.9";
+
+  src = python2.pkgs.fetchPypi {
+    inherit pname version;
+    sha256 = "a797b6e92ad2acdf41e033c1368ab365aa268f4d8458b396a5770fa6c2bc3f54";
+  };
+
+  propagatedBuildInputs = with python2.pkgs; [ boto crcmod psutil ];
+
+  # No tests implemented
+  doCheck = false;
+
+  meta = with lib; {
+    description = "Synchronise btrfs snapshots";
+    longDescription = ''
+      ButterSink is like rsync, but for btrfs subvolumes instead of files,
+      which makes it much more efficient for things like archiving backup
+      snapshots. It is built on top of btrfs send and receive capabilities.
+      Sources and destinations can be local btrfs file systems, remote btrfs
+      file systems over SSH, or S3 buckets.
+    '';
+    homepage = "https://github.com/AmesCornish/buttersink/wiki";
+    license = licenses.gpl3;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/catcli/default.nix b/nixpkgs/pkgs/tools/filesystems/catcli/default.nix
new file mode 100644
index 000000000000..8f4e9941029b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/catcli/default.nix
@@ -0,0 +1,30 @@
+{ lib, stdenv
+, fetchFromGitHub
+, buildPythonApplication
+, docopt, anytree
+}:
+
+buildPythonApplication rec {
+
+  pname = "catcli";
+  version = "0.6.0";
+
+  src = fetchFromGitHub {
+    owner = "deadc0de6";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "0myhvflph4fayl2bg8m9a7prh5pcnvnb75p0jb4jpmbx7jyn7ihp";
+  };
+
+  propagatedBuildInputs = [ docopt anytree ];
+
+  postPatch = "patchShebangs . ";
+
+  meta = with lib; {
+    description = "The command line catalog tool for your offline data";
+    homepage = "https://github.com/deadc0de6/catcli";
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ petersjt014 ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/ceph/0000-fix-SPDK-build-env.patch b/nixpkgs/pkgs/tools/filesystems/ceph/0000-fix-SPDK-build-env.patch
new file mode 100644
index 000000000000..a117408b000f
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/ceph/0000-fix-SPDK-build-env.patch
@@ -0,0 +1,11 @@
+--- a/cmake/modules/BuildSPDK.cmake
++++ b/cmake/modules/BuildSPDK.cmake
+@@ -35,7 +35,7 @@ macro(build_spdk)
+     # unset $CFLAGS, otherwise it will interfere with how SPDK sets
+     # its include directory.
+     # unset $LDFLAGS, otherwise SPDK will fail to mock some functions.
+-    BUILD_COMMAND env -i PATH=$ENV{PATH} CC=${CMAKE_C_COMPILER} ${make_cmd} EXTRA_CFLAGS="${spdk_CFLAGS}"
++    BUILD_COMMAND env -i PATH=$ENV{PATH} CC=${CMAKE_C_COMPILER} ${make_cmd} EXTRA_CFLAGS="${spdk_CFLAGS}" C_OPT="-mssse3"
+     BUILD_IN_SOURCE 1
+     INSTALL_COMMAND "true")
+   unset(make_cmd)
diff --git a/nixpkgs/pkgs/tools/filesystems/ceph/ceph-glibc-2-32-sigdescr_np.patch b/nixpkgs/pkgs/tools/filesystems/ceph/ceph-glibc-2-32-sigdescr_np.patch
new file mode 100644
index 000000000000..f78c7af9e35a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/ceph/ceph-glibc-2-32-sigdescr_np.patch
@@ -0,0 +1,63 @@
+From b9b6faf66ae67648626470cb4fc3f0850ac4d842 Mon Sep 17 00:00:00 2001
+From: David Disseldorp <ddiss@suse.de>
+Date: Tue, 1 Sep 2020 13:49:21 +0200
+Subject: [PATCH] cmake: detect and use sigdescr_np() if available
+
+sys_siglist is deprecated with glibc 2.32. A new thread-safe and
+async-signal safe sigdescr_np() function is provided, so use it if
+available.
+
+Fixes: https://tracker.ceph.com/issues/47187
+Signed-off-by: David Disseldorp <ddiss@suse.de>
+---
+ cmake/modules/CephChecks.cmake | 1 +
+ src/global/signal_handler.h    | 8 +++++---
+ src/include/config-h.in.cmake  | 3 +++
+ 3 files changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/cmake/modules/CephChecks.cmake b/cmake/modules/CephChecks.cmake
+index 23687283a7c6..ca86dcbc73de 100644
+--- a/cmake/modules/CephChecks.cmake
++++ b/cmake/modules/CephChecks.cmake
+@@ -24,6 +24,7 @@ check_function_exists(strerror_r HAVE_Strerror_R)
+ check_function_exists(name_to_handle_at HAVE_NAME_TO_HANDLE_AT)
+ check_function_exists(pipe2 HAVE_PIPE2)
+ check_function_exists(accept4 HAVE_ACCEPT4)
++check_function_exists(sigdescr_np HAVE_SIGDESCR_NP)
+ 
+ include(CMakePushCheckState)
+ cmake_push_check_state(RESET)
+diff --git a/src/global/signal_handler.h b/src/global/signal_handler.h
+index 476724201aa9..c101b2e28733 100644
+--- a/src/global/signal_handler.h
++++ b/src/global/signal_handler.h
+@@ -20,10 +20,12 @@
+ 
+ typedef void (*signal_handler_t)(int);
+ 
+-#ifndef HAVE_REENTRANT_STRSIGNAL
+-# define sig_str(signum) sys_siglist[signum]
+-#else
++#ifdef HAVE_SIGDESCR_NP
++# define sig_str(signum) sigdescr_np(signum)
++#elif HAVE_REENTRANT_STRSIGNAL
+ # define sig_str(signum) strsignal(signum)
++#else
++# define sig_str(signum) sys_siglist[signum]
+ #endif
+ 
+ void install_sighandler(int signum, signal_handler_t handler, int flags);
+diff --git a/src/include/config-h.in.cmake b/src/include/config-h.in.cmake
+index 1ea3703f620c..59bd4273511a 100644
+--- a/src/include/config-h.in.cmake
++++ b/src/include/config-h.in.cmake
+@@ -220,6 +220,9 @@
+ /* Define to 1 if you have sched.h. */
+ #cmakedefine HAVE_SCHED 1
+ 
++/* Define to 1 if you have sigdescr_np. */
++#cmakedefine HAVE_SIGDESCR_NP 1
++
+ /* Support SSE (Streaming SIMD Extensions) instructions */
+ #cmakedefine HAVE_SSE
+ 
diff --git a/nixpkgs/pkgs/tools/filesystems/ceph/default.nix b/nixpkgs/pkgs/tools/filesystems/ceph/default.nix
new file mode 100644
index 000000000000..c11828e24ca7
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/ceph/default.nix
@@ -0,0 +1,220 @@
+{ stdenv, runCommand, fetchurl
+, fetchpatch
+, ensureNewerSourcesHook
+, cmake, pkg-config
+, which, git
+, boost, python3Packages
+, libxml2, zlib, lz4
+, openldap, lttng-ust
+, babeltrace, gperf
+, gtest
+, cunit, snappy
+, rocksdb, makeWrapper
+, leveldb, oathToolkit
+, libnl, libcap_ng
+, rdkafka
+
+# Optional Dependencies
+, yasm ? null, fcgi ? null, expat ? null
+, curl ? null, fuse ? null
+, libedit ? null, libatomic_ops ? null
+, libs3 ? null
+
+# Mallocs
+, jemalloc ? null, gperftools ? null
+
+# Crypto Dependencies
+, cryptopp ? null
+, nss ? null, nspr ? null
+
+# Linux Only Dependencies
+, linuxHeaders, util-linux, libuuid, udev, keyutils, rdma-core, rabbitmq-c
+, libaio ? null, libxfs ? null, zfs ? null
+, ...
+}:
+
+# We must have one crypto library
+assert cryptopp != null || (nss != null && nspr != null);
+
+with stdenv; with lib;
+let
+  shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null;
+
+  optYasm = shouldUsePkg yasm;
+  optFcgi = shouldUsePkg fcgi;
+  optExpat = shouldUsePkg expat;
+  optCurl = shouldUsePkg curl;
+  optFuse = shouldUsePkg fuse;
+  optLibedit = shouldUsePkg libedit;
+  optLibatomic_ops = shouldUsePkg libatomic_ops;
+  optLibs3 = shouldUsePkg libs3;
+
+  optJemalloc = shouldUsePkg jemalloc;
+  optGperftools = shouldUsePkg gperftools;
+
+  optCryptopp = shouldUsePkg cryptopp;
+  optNss = shouldUsePkg nss;
+  optNspr = shouldUsePkg nspr;
+
+  optLibaio = shouldUsePkg libaio;
+  optLibxfs = shouldUsePkg libxfs;
+  optZfs = shouldUsePkg zfs;
+
+  hasRadosgw = optFcgi != null && optExpat != null && optCurl != null && optLibedit != null;
+
+
+  # Malloc implementation (can be jemalloc, tcmalloc or null)
+  malloc = if optJemalloc != null then optJemalloc else optGperftools;
+
+  # We prefer nss over cryptopp
+  cryptoStr = if optNss != null && optNspr != null then "nss" else
+    if optCryptopp != null then "cryptopp" else "none";
+
+  cryptoLibsMap = {
+    nss = [ optNss optNspr ];
+    cryptopp = [ optCryptopp ];
+    none = [ ];
+  };
+
+  getMeta = description: {
+     homepage = "https://ceph.com/";
+     inherit description;
+     license = with licenses; [ lgpl21 gpl2 bsd3 mit publicDomain ];
+     maintainers = with maintainers; [ adev ak johanot krav ];
+     platforms = [ "x86_64-linux" "aarch64-linux" ];
+   };
+
+  ceph-common = python3Packages.buildPythonPackage rec{
+    pname = "ceph-common";
+    inherit src version;
+
+    sourceRoot = "ceph-${version}/src/python-common";
+
+    checkInputs = [ python3Packages.pytest ];
+    propagatedBuildInputs = with python3Packages; [ pyyaml six ];
+
+    meta = getMeta "Ceph common module for code shared by manager modules";
+  };
+
+  ceph-python-env = python3Packages.python.withPackages (ps: [
+    ps.sphinx
+    ps.flask
+    ps.cython
+    ps.setuptools
+    ps.virtualenv
+    # Libraries needed by the python tools
+    ps.Mako
+    ceph-common
+    ps.cherrypy
+    ps.dateutil
+    ps.jsonpatch
+    ps.pecan
+    ps.prettytable
+    ps.pyjwt
+    ps.webob
+    ps.bcrypt
+    # scipy > 1.3 breaks diskprediction_local, leading to mgr hang on startup
+    # Bump (and get rid of scipy_1_3) once these issues are resolved:
+    # https://tracker.ceph.com/issues/42764 https://tracker.ceph.com/issues/45147
+    ps.scipy_1_3
+    ps.six
+    ps.pyyaml
+  ]);
+  sitePackages = ceph-python-env.python.sitePackages;
+
+  version = "15.2.8";
+  src = fetchurl {
+    url = "http://download.ceph.com/tarballs/ceph-${version}.tar.gz";
+    sha256 = "1nmrras3g2zapcd06qr5m7y4zkymnr0r53jkpicjw2g4q7wfmib4";
+  };
+in rec {
+  ceph = stdenv.mkDerivation {
+    pname = "ceph";
+    inherit src version;
+
+    patches = [
+      ./0000-fix-SPDK-build-env.patch
+      ./ceph-glibc-2-32-sigdescr_np.patch
+    ];
+
+    nativeBuildInputs = [
+      cmake
+      pkg-config which git python3Packages.wrapPython makeWrapper
+      python3Packages.python # for the toPythonPath function
+      (ensureNewerSourcesHook { year = "1980"; })
+    ];
+
+    buildInputs = cryptoLibsMap.${cryptoStr} ++ [
+      boost ceph-python-env libxml2 optYasm optLibatomic_ops optLibs3
+      malloc zlib openldap lttng-ust babeltrace gperf gtest cunit
+      snappy rocksdb lz4 oathToolkit leveldb libnl libcap_ng rdkafka
+    ] ++ optionals stdenv.isLinux [
+      linuxHeaders util-linux libuuid udev keyutils optLibaio optLibxfs optZfs
+      # ceph 14
+      rdma-core rabbitmq-c
+    ] ++ optionals hasRadosgw [
+      optFcgi optExpat optCurl optFuse optLibedit
+    ];
+
+    pythonPath = [ ceph-python-env "${placeholder "out"}/${ceph-python-env.sitePackages}" ];
+
+    preConfigure =''
+      substituteInPlace src/common/module.c --replace "/sbin/modinfo"  "modinfo"
+      substituteInPlace src/common/module.c --replace "/sbin/modprobe" "modprobe"
+
+      # for pybind/rgw to find internal dep
+      export LD_LIBRARY_PATH="$PWD/build/lib''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
+      # install target needs to be in PYTHONPATH for "*.pth support" check to succeed
+      # set PYTHONPATH, so the build system doesn't silently skip installing ceph-volume and others
+      export PYTHONPATH=${ceph-python-env}/${sitePackages}:$lib/${sitePackages}:$out/${sitePackages}
+      patchShebangs src/script src/spdk src/test src/tools
+    '';
+
+    cmakeFlags = [
+      "-DWITH_PYTHON3=ON"
+      "-DWITH_SYSTEM_ROCKSDB=OFF"
+      "-DCMAKE_INSTALL_DATADIR=${placeholder "lib"}/lib"
+
+
+      "-DWITH_SYSTEM_BOOST=ON"
+      "-DWITH_SYSTEM_ROCKSDB=ON"
+      "-DWITH_SYSTEM_GTEST=ON"
+      "-DMGR_PYTHON_VERSION=${ceph-python-env.python.pythonVersion}"
+      "-DWITH_SYSTEMD=OFF"
+      "-DWITH_TESTS=OFF"
+      # TODO breaks with sandbox, tries to download stuff with npm
+      "-DWITH_MGR_DASHBOARD_FRONTEND=OFF"
+    ];
+
+    postFixup = ''
+      wrapPythonPrograms
+      wrapProgram $out/bin/ceph-mgr --prefix PYTHONPATH ":" "$(toPythonPath ${placeholder "out"}):$(toPythonPath ${ceph-python-env})"
+
+      # Test that ceph-volume exists since the build system has a tendency to
+      # silently drop it with misconfigurations.
+      test -f $out/bin/ceph-volume
+    '';
+
+    outputs = [ "out" "lib" "dev" "doc" "man" ];
+
+    doCheck = false; # uses pip to install things from the internet
+
+    meta = getMeta "Distributed storage system";
+
+    passthru.version = version;
+  };
+
+  ceph-client = runCommand "ceph-client-${version}" {
+      meta = getMeta "Tools needed to mount Ceph's RADOS Block Devices";
+    } ''
+      mkdir -p $out/{bin,etc,${sitePackages},share/bash-completion/completions}
+      cp -r ${ceph}/bin/{ceph,.ceph-wrapped,rados,rbd,rbdmap} $out/bin
+      cp -r ${ceph}/bin/ceph-{authtool,conf,dencoder,rbdnamer,syn} $out/bin
+      cp -r ${ceph}/bin/rbd-replay* $out/bin
+      cp -r ${ceph}/${sitePackages} $out/${sitePackages}
+      cp -r ${ceph}/etc/bash_completion.d $out/share/bash-completion/completions
+      # wrapPythonPrograms modifies .ceph-wrapped, so lets just update its paths
+      substituteInPlace $out/bin/ceph          --replace ${ceph} $out
+      substituteInPlace $out/bin/.ceph-wrapped --replace ${ceph} $out
+   '';
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/chunkfs/default.nix b/nixpkgs/pkgs/tools/filesystems/chunkfs/default.nix
new file mode 100644
index 000000000000..e4a20e3da5a0
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/chunkfs/default.nix
@@ -0,0 +1,30 @@
+{ lib, stdenv, fetchurl, perl, fuse }:
+
+stdenv.mkDerivation rec {
+  version = "0.7";
+  pname = "chunkfs";
+
+  src = fetchurl {
+    url = "https://chunkfs.florz.de/chunkfs_${version}.tar.gz";
+    sha256 = "4c168fc2b265a6ba34afc565707ea738f34375325763c0596f2cfa1c9b8d40f1";
+  };
+
+  buildInputs = [perl fuse];
+
+  makeFlags = [
+    "DESTDIR=$(out)"
+    "PREFIX="
+  ];
+
+  preInstall = ''
+    mkdir -p $out/bin
+    mkdir -p $out/share/man/man1
+  '';
+
+  meta = {
+    description = "FUSE filesystems for viewing chunksync-style directory trees as a block device and vice versa";
+    homepage = "http://chunkfs.florz.de/";
+    license = lib.licenses.gpl2;
+    platforms = with lib.platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/ciopfs/default.nix b/nixpkgs/pkgs/tools/filesystems/ciopfs/default.nix
new file mode 100644
index 000000000000..cfe80cfce65e
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/ciopfs/default.nix
@@ -0,0 +1,22 @@
+{ lib, stdenv, fetchurl, pkg-config, fuse, glib, attr }:
+
+stdenv.mkDerivation rec {
+  name = "ciopfs-0.4";
+
+  src = fetchurl {
+    url = "http://www.brain-dump.org/projects/ciopfs/${name}.tar.gz";
+    sha256 = "0sr9i9b3qfwbfvzvk00yrrg3x2xqk1njadbldkvn7hwwa4z5bm9l";
+  };
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ fuse glib attr ];
+
+  makeFlags = [ "DESTDIR=$(out)" "PREFIX=" ];
+
+  meta = {
+    homepage = "https://www.brain-dump.org/projects/ciopfs/";
+    description = "A case-insensitive filesystem layered on top of any other filesystem";
+    license = lib.licenses.gpl2;
+    platforms = lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/convoy/default.nix b/nixpkgs/pkgs/tools/filesystems/convoy/default.nix
new file mode 100644
index 000000000000..4c493ea22527
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/convoy/default.nix
@@ -0,0 +1,26 @@
+# This file was generated by go2nix.
+{ lib, stdenv, buildGoPackage, fetchFromGitHub, lvm2 }:
+
+buildGoPackage rec {
+  pname = "convoy";
+  version = "0.5.2";
+
+  goPackagePath = "github.com/rancher/convoy";
+
+  src = fetchFromGitHub {
+    rev = "v${version}";
+    owner = "rancher";
+    repo = "convoy";
+    sha256 = "09nygrxd5hril4xcfsvgjg74xxhhimznqq4sdk0f360c5ra0dbhj";
+  };
+
+  buildInputs = [lvm2];
+
+  meta = with lib; {
+    homepage = "https://github.com/rancher/convoy";
+    description = "A Docker volume plugin, managing persistent container volumes";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ offline ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/cpcfs/default.nix b/nixpkgs/pkgs/tools/filesystems/cpcfs/default.nix
new file mode 100644
index 000000000000..2aa63208e008
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/cpcfs/default.nix
@@ -0,0 +1,41 @@
+{ lib, stdenv, fetchFromGitHub, makeWrapper, ncurses, readline, ronn }:
+
+stdenv.mkDerivation rec {
+
+  pname = "cpcfs";
+  version = "0.85.4";
+
+  src = fetchFromGitHub {
+    owner = "derikz";
+    repo = "cpcfs";
+    rev = "v${version}";
+    sha256 = "0rfbry0qy8mv746mzk9zdfffkdgq4w7invgb5cszjma2cp83q3i2";
+  };
+
+  sourceRoot = "source/src";
+
+  nativeBuildInputs = [ makeWrapper ncurses readline ronn ];
+
+  postPatch = ''
+    substituteInPlace Makefile \
+      --replace '-ltermcap' '-lncurses' \
+      --replace '-L /usr/lib/termcap' ' '
+  '';
+
+  installPhase = ''
+    runHook preInstall
+    mkdir -p $out/bin
+    mkdir -p $out/man/man1
+    cp cpcfs $out/bin
+    ronn --roff ../template.doc --pipe > $out/man/man1/cpcfs.1
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    description = "Manipulating CPC dsk images and files";
+    homepage = "https://github.com/derikz/cpcfs/" ;
+    license = licenses.bsd2;
+    maintainers = [ ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/cryfs/default.nix b/nixpkgs/pkgs/tools/filesystems/cryfs/default.nix
new file mode 100644
index 000000000000..3777c4e7cb16
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/cryfs/default.nix
@@ -0,0 +1,76 @@
+{ lib, stdenv, fetchFromGitHub, fetchpatch
+, cmake, pkg-config, python, gtest
+, boost, cryptopp, curl, fuse, openssl
+}:
+
+stdenv.mkDerivation rec {
+  pname = "cryfs";
+  version = "0.10.2";
+
+  src = fetchFromGitHub {
+    owner  = "cryfs";
+    repo   = "cryfs";
+    rev    = version;
+    sha256 = "1m6rcc82hbaiwcwcvf5xmxma8n0jal9zhcykv9xgwiax4ny0l8kz";
+  };
+
+  patches = [
+    (fetchpatch {
+      name = "cryfs-0.10.2-install-targets.patch";
+      url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-fs/cryfs/files/cryfs-0.10.2-install-targets.patch?id=192ac7421ddd4093125f4997898fb62e8a140a44";
+      sha256 = "1jz6gpi1i7dnfm88a6n3mccwfmsmvg0d0bmp3fmqqrkbcg7in00l";
+    })
+    (fetchpatch {
+      name = "cryfs-0.10.2-unbundle-libs.patch";
+      url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-fs/cryfs/files/cryfs-0.10.2-unbundle-libs.patch?id=192ac7421ddd4093125f4997898fb62e8a140a44";
+      sha256 = "0hzss5rawcjrh8iqzc40w5yjhxdqya4gbg6dzap70180s50mahzs";
+    })
+  ];
+
+  postPatch = ''
+    patchShebangs src
+
+    # remove tests that require network access:
+    substituteInPlace test/cpp-utils/CMakeLists.txt \
+      --replace "network/CurlHttpClientTest.cpp" "" \
+      --replace "network/FakeHttpClientTest.cpp" ""
+
+    # remove CLI test trying to access /dev/fuse
+    substituteInPlace test/cryfs-cli/CMakeLists.txt \
+      --replace "CliTest_IntegrityCheck.cpp" ""
+
+    # downsize large file test as 4.5G is too big for Hydra:
+    substituteInPlace test/cpp-utils/data/DataTest.cpp \
+      --replace "(4.5L*1024*1024*1024)" "(0.5L*1024*1024*1024)"
+  '';
+
+  nativeBuildInputs = [ cmake gtest pkg-config python ];
+
+  buildInputs = [ boost cryptopp curl fuse openssl ];
+
+  cmakeFlags = [
+    "-DCRYFS_UPDATE_CHECKS:BOOL=FALSE"
+    "-DBoost_USE_STATIC_LIBS:BOOL=FALSE" # this option is case sensitive
+    "-DUSE_SYSTEM_LIBS:BOOL=TRUE"
+    "-DBUILD_TESTING:BOOL=TRUE"
+  ];
+
+  doCheck = (!stdenv.isDarwin); # Cryfs tests are broken on darwin
+
+  checkPhase = ''
+    # Skip CMakeFiles directory and tests depending on fuse (does not work well with sandboxing)
+    SKIP_IMPURE_TESTS="CMakeFiles|fspp|my-gtest-main"
+
+    for t in $(ls -d test/*/ | egrep -v "$SKIP_IMPURE_TESTS"); do
+      "./$t$(basename $t)-test"
+    done
+  '';
+
+  meta = with lib; {
+    description = "Cryptographic filesystem for the cloud";
+    homepage    = "https://www.cryfs.org";
+    license     = licenses.lgpl3;
+    maintainers = with maintainers; [ peterhoeg c0bw3b ];
+    platforms   = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/curlftpfs/default.nix b/nixpkgs/pkgs/tools/filesystems/curlftpfs/default.nix
new file mode 100644
index 000000000000..4bfa22838ad9
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/curlftpfs/default.nix
@@ -0,0 +1,21 @@
+{lib, stdenv, fetchurl, fuse, curl, pkg-config, glib, zlib}:
+
+stdenv.mkDerivation {
+  name = "curlftpfs-0.9.2";
+  src = fetchurl {
+    url = "mirror://sourceforge/curlftpfs/curlftpfs-0.9.2.tar.gz";
+    sha256 = "0n397hmv21jsr1j7zx3m21i7ryscdhkdsyqpvvns12q7qwwlgd2f";
+  };
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [fuse curl glib zlib];
+
+  doCheck = false; # fails, doesn't work well too, btw
+
+  meta = with lib; {
+    description = "Filesystem for accessing FTP hosts based on FUSE and libcurl";
+    homepage = "http://curlftpfs.sourceforge.net";
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/darling-dmg/default.nix b/nixpkgs/pkgs/tools/filesystems/darling-dmg/default.nix
new file mode 100644
index 000000000000..b5addf833c1b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/darling-dmg/default.nix
@@ -0,0 +1,29 @@
+{ lib, stdenv, fetchFromGitHub, cmake, fuse, zlib, bzip2, openssl, libxml2, icu, lzfse }:
+
+stdenv.mkDerivation rec {
+  pname = "darling-dmg";
+  version = "1.0.4+git20200427";
+
+  src = fetchFromGitHub {
+    owner = "darlinghq";
+    repo = "darling-dmg";
+    rev = "71cc76c792db30328663272788c0b64aca27fdb0";
+    sha256 = "08iphkxlmjddrxpbm13gxyqwcrd0k65z3l1944n4pccb6qbyj8gv";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ fuse openssl zlib bzip2 libxml2 icu lzfse ];
+
+  CXXFLAGS = [
+    "-DCOMPILE_WITH_LZFSE=1"
+    "-llzfse"
+  ];
+
+  meta = with lib; {
+    homepage = "https://www.darlinghq.org/";
+    description = "Darling lets you open macOS dmgs on Linux";
+    platforms = platforms.linux;
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ Luflosi ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/davfs2/0001-umount_davfs-substitute-ps-command.patch b/nixpkgs/pkgs/tools/filesystems/davfs2/0001-umount_davfs-substitute-ps-command.patch
new file mode 100644
index 000000000000..3fbbc4c7d0fd
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/davfs2/0001-umount_davfs-substitute-ps-command.patch
@@ -0,0 +1,25 @@
+From 0cb1321c4cbb2978318ddad73c9ee6f2a19c55c8 Mon Sep 17 00:00:00 2001
+From: Florian Klink <flokli@flokli.de>
+Date: Sat, 11 Jan 2020 21:06:33 +0100
+Subject: [PATCH] umount_davfs: substitute ps command
+
+---
+ src/umount_davfs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/umount_davfs.c b/src/umount_davfs.c
+index b7019c3..a278679 100644
+--- a/src/umount_davfs.c
++++ b/src/umount_davfs.c
+@@ -157,7 +157,7 @@ main(int argc, char *argv[])
+     }
+     fclose(file);
+ 
+-    char *ps_command = ne_concat("ps -p ", pid, NULL);
++    char *ps_command = ne_concat("@ps@ -p ", pid, NULL);
+     FILE *ps_in = popen(ps_command, "r");
+     if (!ps_in) {
+         error(0, 0,
+-- 
+2.24.1
+
diff --git a/nixpkgs/pkgs/tools/filesystems/davfs2/0002-Make-sure-that-the-setuid-wrapped-umount-is-invoked.patch b/nixpkgs/pkgs/tools/filesystems/davfs2/0002-Make-sure-that-the-setuid-wrapped-umount-is-invoked.patch
new file mode 100644
index 000000000000..0e31725936fa
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/davfs2/0002-Make-sure-that-the-setuid-wrapped-umount-is-invoked.patch
@@ -0,0 +1,42 @@
+From 56873cf29974ff0dfc1ba1afb7022ce49e300835 Mon Sep 17 00:00:00 2001
+From: Maximilian Bosch <maximilian@mbosch.me>
+Date: Wed, 11 Nov 2020 11:58:25 +0100
+Subject: [PATCH 2/2] Make sure that the setuid-wrapped `umount` is invoked
+
+---
+ src/dav_fuse.c     | 2 +-
+ src/umount_davfs.c | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/dav_fuse.c b/src/dav_fuse.c
+index 734bc1f..4501433 100644
+--- a/src/dav_fuse.c
++++ b/src/dav_fuse.c
+@@ -187,7 +187,7 @@ dav_fuse_loop(int device, char *mpoint, size_t bufsize, time_t idle_time,
+             unmounting = 1;
+             pid_t pid = fork();
+             if (pid == 0) {
+-                execl("/bin/umount", "umount", "-il", mountpoint, NULL);
++                execl("@wrapperDir@/umount", "umount", "-il", mountpoint, NULL);
+                 _exit(EXIT_FAILURE);
+             }
+         }
+diff --git a/src/umount_davfs.c b/src/umount_davfs.c
+index b7019c3..75e3b4b 100644
+--- a/src/umount_davfs.c
++++ b/src/umount_davfs.c
+@@ -122,9 +122,9 @@ main(int argc, char *argv[])
+ 
+     char *umount_command = NULL;
+     if (mpoint) {
+-        umount_command = ne_concat("umount -i '", mpoint, "'", NULL);
++        umount_command = ne_concat("@wrapperDir@/umount -i '", mpoint, "'", NULL);
+     } else {
+-        umount_command = ne_concat("umount -i '", argv[optind], "'", NULL);
++        umount_command = ne_concat("@wrapperDir@/umount -i '", argv[optind], "'", NULL);
+         error(0, 0,
+               _("\n"
+                 "  can't evaluate PID file name;\n"
+-- 
+2.28.0
+
diff --git a/nixpkgs/pkgs/tools/filesystems/davfs2/default.nix b/nixpkgs/pkgs/tools/filesystems/davfs2/default.nix
new file mode 100644
index 000000000000..7652cc978785
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/davfs2/default.nix
@@ -0,0 +1,55 @@
+{ lib, stdenv
+, fetchurl
+, fetchpatch
+, neon
+, procps
+, substituteAll
+, zlib
+, wrapperDir ? "/run/wrappers/bin"
+}:
+
+stdenv.mkDerivation rec {
+  name = "davfs2-1.6.0";
+
+  src = fetchurl {
+    url = "mirror://savannah/davfs2/${name}.tar.gz";
+    sha256 = "sha256-LmtnVoW9kXdyvmDwmZrgmMgPef8g3BMej+xFR8u2O1A=";
+  };
+
+  buildInputs = [ neon zlib ];
+
+  patches = [
+    ./fix-sysconfdir.patch
+    (substituteAll {
+      src = ./0001-umount_davfs-substitute-ps-command.patch;
+      ps = "${procps}/bin/ps";
+    })
+    (substituteAll {
+      src = ./0002-Make-sure-that-the-setuid-wrapped-umount-is-invoked.patch;
+      inherit wrapperDir;
+    })
+  ];
+
+  configureFlags = [ "--sysconfdir=/etc" ];
+
+  makeFlags = [
+    "sbindir=$(out)/sbin"
+    "ssbindir=$(out)/sbin"
+  ];
+
+  meta = {
+    homepage = "https://savannah.nongnu.org/projects/davfs2";
+    description = "Mount WebDAV shares like a typical filesystem";
+    license = lib.licenses.gpl3Plus;
+
+    longDescription = ''
+      Web Distributed Authoring and Versioning (WebDAV), an extension to
+      the HTTP-protocol, allows authoring of resources on a remote web
+      server. davfs2 provides the ability to access such resources like
+      a typical filesystem, allowing for use by standard applications
+      with no built-in support for WebDAV.
+    '';
+
+    platforms = lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/davfs2/fix-sysconfdir.patch b/nixpkgs/pkgs/tools/filesystems/davfs2/fix-sysconfdir.patch
new file mode 100644
index 000000000000..f71248a28f4d
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/davfs2/fix-sysconfdir.patch
@@ -0,0 +1,60 @@
+diff -ubr davfs2-1.4.7-orig/etc/Makefile.am davfs2-1.4.7/etc/Makefile.am
+--- davfs2-1.4.7-orig/etc/Makefile.am	2013-02-21 11:45:00.185763558 +0100
++++ davfs2-1.4.7/etc/Makefile.am	2013-02-21 11:53:05.423197775 +0100
+@@ -24,17 +24,17 @@
+ 
+ install-data-local: $(dist_pkgdata_DATA)
+ 	@$(NORMAL_INSTALL)
+-	$(mkinstalldirs) $(DESTDIR)$(pkgsysconfdir)
+-	$(INSTALL_DATA) -b davfs2.conf $(DESTDIR)$(pkgsysconfdir)/davfs2.conf
+-	$(INSTALL_DATA) -b -m 600 secrets $(DESTDIR)$(pkgsysconfdir)/secrets
+-	$(mkinstalldirs) $(DESTDIR)$(pkgsysconfdir)/certs
+-	$(mkinstalldirs) $(DESTDIR)$(pkgsysconfdir)/certs/private
+-	chmod 700 $(DESTDIR)$(pkgsysconfdir)/certs/private
++	$(mkinstalldirs) $(out)$(pkgsysconfdir)
++	$(INSTALL_DATA) -b davfs2.conf $(out)$(pkgsysconfdir)/davfs2.conf
++	$(INSTALL_DATA) -b -m 600 secrets $(out)$(pkgsysconfdir)/secrets
++	$(mkinstalldirs) $(out)$(pkgsysconfdir)/certs
++	$(mkinstalldirs) $(out)$(pkgsysconfdir)/certs/private
++	chmod 700 $(out)$(pkgsysconfdir)/certs/private
+ 
+ uninstall-local:
+ 	@$(NORMAL_UNINSTALL)
+ 	@list='$(dist_pkgdata_DATA)'; for p in $$list; do \
+ 	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+-	  echo " rm -f $(DESTDIR)$(pkgsysconfdir)/$$f"; \
+-	  rm -f $(DESTDIR)$(pkgsysconfdir)/$$f; \
++	  echo " rm -f $(out)$(pkgsysconfdir)/$$f"; \
++	  rm -f $(out)$(pkgsysconfdir)/$$f; \
+ 	done
+diff -ubr davfs2-1.4.7-orig/etc/Makefile.in davfs2-1.4.7/etc/Makefile.in
+--- davfs2-1.4.7-orig/etc/Makefile.in	2013-02-21 11:45:00.185763558 +0100
++++ davfs2-1.4.7/etc/Makefile.in	2013-02-21 11:53:27.241207128 +0100
+@@ -408,19 +408,19 @@
+ 
+ install-data-local: $(dist_pkgdata_DATA)
+ 	@$(NORMAL_INSTALL)
+-	$(mkinstalldirs) $(DESTDIR)$(pkgsysconfdir)
+-	$(INSTALL_DATA) -b davfs2.conf $(DESTDIR)$(pkgsysconfdir)/davfs2.conf
+-	$(INSTALL_DATA) -b -m 600 secrets $(DESTDIR)$(pkgsysconfdir)/secrets
+-	$(mkinstalldirs) $(DESTDIR)$(pkgsysconfdir)/certs
+-	$(mkinstalldirs) $(DESTDIR)$(pkgsysconfdir)/certs/private
+-	chmod 700 $(DESTDIR)$(pkgsysconfdir)/certs/private
++	$(mkinstalldirs) $(out)$(pkgsysconfdir)
++	$(INSTALL_DATA) -b davfs2.conf $(out)$(pkgsysconfdir)/davfs2.conf
++	$(INSTALL_DATA) -b -m 600 secrets $(out)$(pkgsysconfdir)/secrets
++	$(mkinstalldirs) $(out)$(pkgsysconfdir)/certs
++	$(mkinstalldirs) $(out)$(pkgsysconfdir)/certs/private
++	chmod 700 $(out)$(pkgsysconfdir)/certs/private
+ 
+ uninstall-local:
+ 	@$(NORMAL_UNINSTALL)
+ 	@list='$(dist_pkgdata_DATA)'; for p in $$list; do \
+ 	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+-	  echo " rm -f $(DESTDIR)$(pkgsysconfdir)/$$f"; \
+-	  rm -f $(DESTDIR)$(pkgsysconfdir)/$$f; \
++	  echo " rm -f $(out)$(pkgsysconfdir)/$$f"; \
++	  rm -f $(out)$(pkgsysconfdir)/$$f; \
+ 	done
+ 
+ # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/nixpkgs/pkgs/tools/filesystems/davfs2/isdir.patch b/nixpkgs/pkgs/tools/filesystems/davfs2/isdir.patch
new file mode 100644
index 000000000000..ae69b4460f5a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/davfs2/isdir.patch
@@ -0,0 +1,30 @@
+diff -ur davfs2-1.4.5-old/src/dav_coda.c davfs2-1.4.5-new/src/dav_coda.c
+--- davfs2-1.4.5-old/src/dav_coda.c	2009-06-04 20:30:32.000000000 +0200
++++ davfs2-1.4.5-new/src/dav_coda.c	2011-02-09 19:51:22.260530572 +0100
+@@ -52,6 +52,10 @@
+ #ifdef HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+ #endif
++#ifdef HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++
+ 
+ #include "defaults.h"
+ #include "mount_davfs.h"
+diff -ur davfs2-1.4.5-old/src/dav_fuse.c davfs2-1.4.5-new/src/dav_fuse.c
+--- davfs2-1.4.5-old/src/dav_fuse.c	2009-06-30 20:06:44.000000000 +0200
++++ davfs2-1.4.5-new/src/dav_fuse.c	2011-02-09 19:52:23.938220524 +0100
+@@ -41,6 +41,12 @@
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
++#ifdef HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++#ifdef HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
+ 
+ #include "defaults.h"
+ #include "mount_davfs.h"
diff --git a/nixpkgs/pkgs/tools/filesystems/dislocker/default.nix b/nixpkgs/pkgs/tools/filesystems/dislocker/default.nix
new file mode 100644
index 000000000000..e65e4665bd56
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/dislocker/default.nix
@@ -0,0 +1,30 @@
+{ lib, stdenv
+, fetchFromGitHub
+, cmake
+, mbedtls
+, fuse
+}:
+
+
+stdenv.mkDerivation rec {
+  pname = "dislocker";
+  version = "0.7.3";
+
+  src = fetchFromGitHub {
+    owner = "aorimn";
+    repo = "dislocker";
+    rev = "v${version}";
+    sha256 = "1ak68s1v5dwh8y2dy5zjybmrh0pnqralmyqzis67y21m87g47h2k";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ fuse mbedtls ];
+
+  meta = with lib; {
+    description = "Read BitLocker encrypted partitions in Linux";
+    homepage    = "https://github.com/aorimn/dislocker";
+    license     = licenses.gpl2;
+    maintainers = with maintainers; [ elitak ];
+    platforms   = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/disorderfs/default.nix b/nixpkgs/pkgs/tools/filesystems/disorderfs/default.nix
new file mode 100644
index 000000000000..27dc55fb9263
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/disorderfs/default.nix
@@ -0,0 +1,24 @@
+{ lib, stdenv, fetchurl, pkg-config, fuse, attr, asciidoc }:
+
+stdenv.mkDerivation rec {
+  pname = "disorderfs";
+  version = "0.5.11";
+
+  src = fetchurl {
+    url = "http://http.debian.net/debian/pool/main/d/disorderfs/disorderfs_${version}.orig.tar.bz2";
+    sha256 = "sha256-KqAMKVUykCgVdNyjacZjpVXqVdeob76v0iOuSd4TNIY=";
+  };
+
+  nativeBuildInputs = [ pkg-config asciidoc ];
+
+  buildInputs = [ fuse attr ];
+
+  installFlags = [ "PREFIX=$(out)" ];
+
+  meta = with lib; {
+    description = "An overlay FUSE filesystem that introduces non-determinism into filesystem metadata";
+    license = licenses.gpl3;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ pSub ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/djmount/default.nix b/nixpkgs/pkgs/tools/filesystems/djmount/default.nix
new file mode 100644
index 000000000000..f5b0a0315dfc
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/djmount/default.nix
@@ -0,0 +1,21 @@
+{ lib, stdenv, fetchurl, pkg-config, fuse }:
+
+stdenv.mkDerivation rec {
+  pname = "djmount";
+  version = "0.71";
+  src = fetchurl {
+    url = "mirror://sourceforge/djmount/${version}/${pname}-${version}.tar.gz";
+    sha256 = "0kqf0cy3h4cfiy5a2sigmisx0lvvsi1n0fbyb9ll5gacmy1b8nxa";
+  };
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ fuse];
+
+  meta = {
+    homepage = "http://djmount.sourceforge.net/";
+    description = "UPnP AV client, mounts as a Linux filesystem the media content of compatible UPnP AV devices";
+    platforms = lib.platforms.linux;
+    maintainers = [ lib.maintainers.jagajaga ];
+    license = lib.licenses.gpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/dosfstools/default.nix b/nixpkgs/pkgs/tools/filesystems/dosfstools/default.nix
new file mode 100644
index 000000000000..14d054364fd9
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/dosfstools/default.nix
@@ -0,0 +1,25 @@
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, libiconv }:
+
+stdenv.mkDerivation rec {
+  pname = "dosfstools";
+  version = "4.1";
+
+  src = fetchFromGitHub {
+    owner = "dosfstools";
+    repo = "dosfstools";
+    rev = "v${version}";
+    sha256 = "1a2zn1655d5f1m6jp9vpn3bp8yfxhcmxx3mx23ai9hmxiydiykr1";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkg-config ]
+    ++ lib.optional stdenv.isDarwin libiconv;
+
+  configureFlags = [ "--enable-compat-symlinks" ];
+
+  meta = {
+    description = "Utilities for creating and checking FAT and VFAT file systems";
+    homepage = "https://github.com/dosfstools/dosfstools";
+    platforms = lib.platforms.linux ++ lib.platforms.darwin;
+    license = lib.licenses.gpl3;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/duff/default.nix b/nixpkgs/pkgs/tools/filesystems/duff/default.nix
new file mode 100644
index 000000000000..f980c7613332
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/duff/default.nix
@@ -0,0 +1,40 @@
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, gettext }:
+
+stdenv.mkDerivation {
+  pname = "duff";
+  # The last release (0.5.2) is more than 2 years old and lacks features like -D,
+  # limiting its usefulness. Upstream appears comatose if not dead.
+  version = "2014-07-03";
+
+  src = fetchFromGitHub {
+    sha256 = "1k2dx38pjzc5d624vw1cs5ipj9fprsm5vqv55agksc29m63lswnx";
+    rev = "f26d4837768b062a3f98fa075c791d9c8a0bb75c";
+    repo = "duff";
+    owner = "elmindreda";
+  };
+
+  nativeBuildInputs = [ autoreconfHook gettext ];
+
+  preAutoreconf = ''
+    # gettexttize rightly refuses to run non-interactively:
+    cp ${gettext}/bin/gettextize .
+    substituteInPlace gettextize \
+      --replace "read dummy" "echo '(Automatically acknowledged)' #"
+    ./gettextize
+    sed 's@po/Makefile.in\( .*\)po/Makefile.in@po/Makefile.in \1@' \
+      -i configure.ac
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = with lib; {
+    description = "Quickly find duplicate files";
+    longDescription = ''
+      Duff is a Unix command-line utility for quickly finding duplicates in
+      a given set of files.
+    '';
+    homepage = "https://duff.dreda.org/";
+    license = licenses.zlib;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/duperemove/default.nix b/nixpkgs/pkgs/tools/filesystems/duperemove/default.nix
new file mode 100644
index 000000000000..bbc346d46f71
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/duperemove/default.nix
@@ -0,0 +1,27 @@
+{ lib, stdenv, fetchFromGitHub, libgcrypt
+, pkg-config, glib, linuxHeaders ? stdenv.cc.libc.linuxHeaders, sqlite }:
+
+stdenv.mkDerivation rec {
+  pname = "duperemove";
+  version = "0.11.2";
+
+  src = fetchFromGitHub {
+    owner = "markfasheh";
+    repo = "duperemove";
+    rev = "v${version}";
+    sha256 = "1a87mka2sfzhbch2jip6wlvvs0glxq9lqwmyrp359d1rmwwmqiw9";
+  };
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ libgcrypt glib linuxHeaders sqlite ];
+
+  makeFlags = [ "PREFIX=${placeholder "out"}" ];
+
+  meta = with lib; {
+    description = "A simple tool for finding duplicated extents and submitting them for deduplication";
+    homepage = "https://github.com/markfasheh/duperemove";
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ bluescreen303 thoughtpolice ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/e2fsprogs/default.nix b/nixpkgs/pkgs/tools/filesystems/e2fsprogs/default.nix
new file mode 100644
index 000000000000..ffe716dceea2
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/e2fsprogs/default.nix
@@ -0,0 +1,75 @@
+{ lib, stdenv, buildPackages, fetchurl, fetchpatch, pkg-config, libuuid, gettext, texinfo
+, shared ? !stdenv.hostPlatform.isStatic
+}:
+
+stdenv.mkDerivation rec {
+  pname = "e2fsprogs";
+  version = "1.45.6";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/${pname}/${pname}-${version}.tar.gz";
+    sha256 = "sha256-X2SsUKK2C45nxbOCuxN97Dk0QBcQPK/8OmFVRCTy1pM=";
+  };
+
+  outputs = [ "bin" "dev" "out" "man" "info" ];
+
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ pkg-config texinfo ];
+  buildInputs = [ libuuid gettext ];
+
+  # Only use glibc's __GNUC_PREREQ(X,Y) (checks if compiler is gcc version >= X.Y) when using glibc
+  patches = if stdenv.hostPlatform.libc == "glibc" then null
+    else [
+      (fetchpatch {
+      url = "https://raw.githubusercontent.com/void-linux/void-packages/9583597eb3e6e6b33f61dbc615d511ce030bc443/srcpkgs/e2fsprogs/patches/fix-glibcism.patch";
+      sha256 = "1gfcsr0i3q8q2f0lqza8na0iy4l4p3cbii51ds6zmj0y4hz2dwhb";
+      excludes = [ "lib/ext2fs/hashmap.h" ];
+      extraPrefix = "";
+      })
+    ];
+
+  postPatch = ''
+    # Remove six failing tests
+    # https://github.com/NixOS/nixpkgs/issues/65471
+    for test in m_image_mmp m_mmp m_mmp_bad_csum m_mmp_bad_magic t_mmp_1on t_mmp_2off; do
+        rm -r "tests/$test"
+    done
+  '';
+
+  configureFlags =
+    if stdenv.isLinux then [
+      # It seems that the e2fsprogs is one of the few packages that cannot be
+      # build with shared and static libs.
+      (if shared then "--enable-elf-shlibs" else "--disable-elf-shlibs")
+      "--enable-symlink-install"
+      "--enable-relative-symlinks"
+      "--with-crond-dir=no"
+      # fsck, libblkid, libuuid and uuidd are in util-linux-ng (the "libuuid" dependency)
+      "--disable-fsck"
+      "--disable-libblkid"
+      "--disable-libuuid"
+      "--disable-uuidd"
+    ] else [
+      "--enable-libuuid --disable-e2initrd-helper"
+    ];
+
+  checkInputs = [ buildPackages.perl ];
+  doCheck = true;
+
+  postInstall = ''
+    # avoid cycle between outputs
+    if [ -f $out/lib/${pname}/e2scrub_all_cron ]; then
+      mv $out/lib/${pname}/e2scrub_all_cron $bin/bin/
+    fi
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = with lib; {
+    homepage = "http://e2fsprogs.sourceforge.net/";
+    description = "Tools for creating and checking ext2/ext3/ext4 filesystems";
+    license = licenses.gpl2;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.eelco ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/e2tools/default.nix b/nixpkgs/pkgs/tools/filesystems/e2tools/default.nix
new file mode 100644
index 000000000000..8621298275e4
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/e2tools/default.nix
@@ -0,0 +1,24 @@
+{ lib, stdenv, fetchurl, pkg-config, e2fsprogs }:
+
+stdenv.mkDerivation rec {
+  pname = "e2tools";
+  version = "0.0.16";
+
+  src = fetchurl {
+    url = "http://home.earthlink.net/~k_sheff/sw/${pname}/${pname}-${version}.tar.gz";
+    sha256 = "16wlc54abqz06dpipjdkw58bncpkxlj5f55lkzy07k3cg0bqwg2f";
+  };
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ e2fsprogs ];
+
+  enableParallelBuilding = true;
+
+  meta = {
+    homepage = "http://home.earthlink.net/~k_sheff/sw/e2tools/";
+    description = "Utilities to read/write/manipulate files in an ext2/ext3 filesystem";
+    license = lib.licenses.gpl2;
+    platforms = lib.platforms.linux;
+    maintainers = [ lib.maintainers.leenaars ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/encfs/default.nix b/nixpkgs/pkgs/tools/filesystems/encfs/default.nix
new file mode 100644
index 000000000000..2b88dde1531a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/encfs/default.nix
@@ -0,0 +1,32 @@
+{ lib, stdenv, fetchFromGitHub
+, cmake, pkg-config, perl
+, gettext, fuse, openssl, tinyxml2
+}:
+
+stdenv.mkDerivation rec {
+  pname = "encfs";
+  version = "1.9.5";
+
+  src = fetchFromGitHub {
+    sha256 = "099rjb02knr6yz7przlnyj62ic0ag5ncs7vvcc36ikyqrmpqsdch";
+    rev = "v${version}";
+    repo = "encfs";
+    owner = "vgough";
+  };
+
+  buildInputs = [ gettext fuse openssl tinyxml2 ];
+  nativeBuildInputs = [ cmake pkg-config perl ];
+
+  cmakeFlags =
+    [ "-DUSE_INTERNAL_TINYXML=OFF"
+      "-DBUILD_SHARED_LIBS=ON"
+      "-DINSTALL_LIBENCFS=ON"
+    ];
+
+  meta = with lib; {
+    description = "An encrypted filesystem in user-space via FUSE";
+    homepage = "https://vgough.github.io/encfs";
+    license = with licenses; [ gpl3 lgpl3 ];
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/exfat/default.nix b/nixpkgs/pkgs/tools/filesystems/exfat/default.nix
new file mode 100644
index 000000000000..8cb552cdc700
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/exfat/default.nix
@@ -0,0 +1,24 @@
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, fuse }:
+
+stdenv.mkDerivation rec {
+  pname = "exfat";
+  version = "1.3.0";
+
+  src = fetchFromGitHub {
+    owner = "relan";
+    repo = "exfat";
+    rev = "v${version}";
+    sha256 = "1q29pcysv747y6dis07953dkax8k9x50b5gg99gpz6rr46xwgkgb";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkg-config ];
+  buildInputs = [ fuse ];
+
+  meta = with lib; {
+    description = "Free exFAT file system implementation";
+    inherit (src.meta) homepage;
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ dywedir ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/ext4magic/default.nix b/nixpkgs/pkgs/tools/filesystems/ext4magic/default.nix
new file mode 100644
index 000000000000..9917bf8d965e
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/ext4magic/default.nix
@@ -0,0 +1,40 @@
+{ lib, stdenv, fetchurl, fetchpatch, file, libuuid, e2fsprogs, zlib, bzip2 }:
+
+stdenv.mkDerivation rec {
+  version = "0.3.2";
+  pname = "ext4magic";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/ext4magic/${pname}-${version}.tar.gz";
+    sha256 = "8d9c6a594f212aecf4eb5410d277caeaea3adc03d35378257dfd017ef20ea115";
+  };
+
+  patches = [
+    (fetchpatch {
+        url = "https://sourceforge.net/p/ext4magic/tickets/10/attachment/ext4magic-0.3.2-i_dir_acl.patch";
+        sha256 = "1accydd8kigid68yir2fbihm3r3x8ws3iyznp25snkx41w6y6x8c";
+    })
+    ./glibc-fix.patch
+  ];
+
+  buildInputs = [ file libuuid e2fsprogs zlib bzip2 ];
+  installFlags = [ "PREFIX=$(out)" ];
+
+  meta = with lib; {
+    description = "Recover / undelete files from ext3 or ext4 partitions";
+    longDescription = ''
+      ext4magic can recover/undelete files from ext3 or ext4 partitions
+      by retrieving file-information from the filesystem journal.
+
+      If the information in the journal are sufficient, ext4magic can
+      recover the most file types, with original filename, owner and group,
+      file mode bits and also the old atime/mtime stamps.
+
+      It's much more effective and works much better than extundelete.
+    '';
+    homepage = "http://ext4magic.sourceforge.net/ext4magic_en.html";
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.rkoe ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/ext4magic/glibc-fix.patch b/nixpkgs/pkgs/tools/filesystems/ext4magic/glibc-fix.patch
new file mode 100644
index 000000000000..906609788939
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/ext4magic/glibc-fix.patch
@@ -0,0 +1,12 @@
+diff --git a/src/recover.c b/src/recover.c
+index 41b4aee..30b5d8f 100644
+--- a/src/recover.c
++++ b/src/recover.c
+@@ -24,6 +24,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <utime.h>
++#include <sys/sysmacros.h>
+ 
+ #ifndef O_LARGEFILE
+ #define O_LARGEFILE 0
diff --git a/nixpkgs/pkgs/tools/filesystems/extundelete/default.nix b/nixpkgs/pkgs/tools/filesystems/extundelete/default.nix
new file mode 100644
index 000000000000..5992fd6a78e4
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/extundelete/default.nix
@@ -0,0 +1,29 @@
+{ lib, stdenv, fetchurl, e2fsprogs }:
+
+stdenv.mkDerivation {
+  version = "0.2.4";
+  pname = "extundelete";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/extundelete/extundelete-0.2.4.tar.bz2";
+    sha256 = "1x0r7ylxlp9lbj3d7sqf6j2a222dwy2nfpff05jd6mkh4ihxvyd1";
+  };
+
+  buildInputs = [ e2fsprogs ];
+
+  # inode field i_dir_acl was repurposed as i_size_high in e2fsprogs 1.44,
+  # breaking the build
+  patchPhase = ''
+    substituteInPlace src/insertionops.cc \
+      --replace "Directory ACL:" "High 32 bits of size:" \
+      --replace "inode.i_dir_acl" "inode.i_size_high"
+  '';
+
+  meta = with lib; {
+    description = "Utility that can recover deleted files from an ext3 or ext4 partition";
+    homepage = "http://extundelete.sourceforge.net/";
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.domenkozar ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/f2fs-tools/default.nix b/nixpkgs/pkgs/tools/filesystems/f2fs-tools/default.nix
new file mode 100644
index 000000000000..4b3d5c9ac1ef
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/f2fs-tools/default.nix
@@ -0,0 +1,25 @@
+{ lib, stdenv, fetchgit, autoreconfHook, libselinux, libuuid, pkg-config }:
+
+stdenv.mkDerivation rec {
+  pname = "f2fs-tools";
+  version = "1.14.0";
+
+  src = fetchgit {
+    url = "https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git";
+    rev = "refs/tags/v${version}";
+    sha256 = "06ss05n87i1c3149qb3n7j1qp2scv3g2adx0v6ljkl59ab9b5saj";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkg-config ];
+  buildInputs = [ libselinux libuuid ];
+
+  patches = [ ./f2fs-tools-cross-fix.patch ];
+
+  meta = with lib; {
+    homepage = "http://git.kernel.org/cgit/linux/kernel/git/jaegeuk/f2fs-tools.git/";
+    description = "Userland tools for the f2fs filesystem";
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ ehmry jagajaga ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/f2fs-tools/f2fs-tools-cross-fix.patch b/nixpkgs/pkgs/tools/filesystems/f2fs-tools/f2fs-tools-cross-fix.patch
new file mode 100644
index 000000000000..e01a97b0bc3c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/f2fs-tools/f2fs-tools-cross-fix.patch
@@ -0,0 +1,29 @@
+diff --git a/configure.ac b/configure.ac
+index 9b0e872..0108219 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -20,14 +20,16 @@ AC_DEFINE([F2FS_MINOR_VERSION], m4_bpatsubst(f2fs_tools_version,
+ 				[\([0-9]*\).\([0-9]*\)\(\w\|\W\)*], [\2]),
+ 				[Minor version for f2fs-tools])
+ 
+-AS_IF([test -d .git],[
+-	AC_DEFINE([F2FS_TOOLS_DATE],
+-		"m4_bpatsubst(f2fs_tools_gitdate,
+-		[\([0-9-]*\)\(\w\|\W\)*], [\1])",
+-		[f2fs-tools date based on Git commits])],[
+-	AC_DEFINE([F2FS_TOOLS_DATE],
+-		"f2fs_tools_date",
+-		[f2fs-tools date based on Source releases])])
++dnl AS_IF([test -d .git],[
++dnl	AC_DEFINE([F2FS_TOOLS_DATE],
++dnl		"m4_bpatsubst(f2fs_tools_gitdate,
++dnl		[\([0-9-]*\)\(\w\|\W\)*], [\1])",
++dnl		[f2fs-tools date based on Git commits])],[
++dnl	AC_DEFINE([F2FS_TOOLS_DATE],
++dnl		"f2fs_tools_date",
++dnl		[f2fs-tools date based on Source releases])])
++
++AC_DEFINE([F2FS_TOOLS_DATE], "f2fs_tools_date", [f2fs-tools date based on Source releases])
+ 
+ AC_CONFIG_SRCDIR([config.h.in])
+ AC_CONFIG_HEADER([config.h])
diff --git a/nixpkgs/pkgs/tools/filesystems/f3/default.nix b/nixpkgs/pkgs/tools/filesystems/f3/default.nix
new file mode 100644
index 000000000000..b9817ecb05c0
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/f3/default.nix
@@ -0,0 +1,57 @@
+{ stdenv, lib, fetchFromGitHub
+, parted, systemd ? null
+}:
+
+stdenv.mkDerivation rec {
+  pname = "f3";
+  version = "8.0";
+
+  src = fetchFromGitHub {
+    owner = "AltraMayor";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "17l5vspfcgfbkqg7bakp3gql29yb05gzawm8n3im30ilzdr53678";
+  };
+
+  postPatch = ''
+     sed -i 's/-oroot -groot//' Makefile
+
+     for f in f3write.h2w log-f3wr; do
+      substituteInPlace $f \
+        --replace '$(dirname $0)' $out/bin
+     done
+  '';
+
+  buildInputs = [
+    parted
+  ]
+  ++ lib.optional stdenv.isLinux systemd;
+
+  enableParallelBuilding = true;
+
+  buildFlags   = [
+    "all" # f3read, f3write
+  ]
+  ++ lib.optional stdenv.isLinux "extra"; # f3brew, f3fix, f3probe
+
+  installFlags = [
+    "PREFIX=${placeholder "out"}"
+  ];
+
+  installTargets = [
+    "install"
+  ]
+  ++ lib.optional stdenv.isLinux "install-extra";
+
+  postInstall = ''
+    install -Dm555 -t $out/bin f3write.h2w log-f3wr
+    install -Dm444 -t $out/share/doc/${pname} LICENSE README.rst
+  '';
+
+  meta = with lib; {
+    description = "Fight Flash Fraud";
+    homepage = "http://oss.digirati.com.br/f3/";
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ makefu ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/fatresize/default.nix b/nixpkgs/pkgs/tools/filesystems/fatresize/default.nix
new file mode 100644
index 000000000000..8f258a79f7de
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/fatresize/default.nix
@@ -0,0 +1,26 @@
+{ lib, stdenv, fetchFromGitHub, parted, util-linux, pkg-config }:
+
+stdenv.mkDerivation rec {
+
+  version = "1.1.0";
+  pname = "fatresize";
+
+  src = fetchFromGitHub {
+    owner = "ya-mouse";
+    repo = "fatresize";
+    rev = "v${version}";
+    sha256 = "1vhz84kxfyl0q7mkqn68nvzzly0a4xgzv76m6db0bk7xyczv1qr2";
+  };
+
+  buildInputs = [ parted util-linux ];
+  nativeBuildInputs = [ pkg-config ];
+
+  propagatedBuildInputs = [ parted util-linux ];
+
+  meta = with lib; {
+    description = "The FAT16/FAT32 non-destructive resizer";
+    homepage = "https://github.com/ya-mouse/fatresize";
+    platforms = platforms.linux;
+    license = licenses.gpl3;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/fatsort/default.nix b/nixpkgs/pkgs/tools/filesystems/fatsort/default.nix
new file mode 100644
index 000000000000..ec7563dfc494
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/fatsort/default.nix
@@ -0,0 +1,26 @@
+{lib, stdenv, fetchurl, help2man}:
+
+stdenv.mkDerivation rec {
+  version = "1.6.3.622";
+  pname = "fatsort";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/fatsort/${pname}-${version}.tar.xz";
+    sha256 = "1z2nabm38lg56h05yx3jjsndbqxk1zbjcisrczzamypn13m98728";
+  };
+
+  patches = [ ./fatsort-Makefiles.patch ];
+
+  buildInputs = [ help2man ];
+
+  makeFlags = [ "PREFIX=${placeholder "out"}" ];
+
+  meta = with lib; {
+    homepage = "http://fatsort.sourceforge.net/";
+    description = "Sorts FAT partition table, for devices that don't do sorting of files";
+    maintainers = [ maintainers.kovirobi ];
+    license = licenses.gpl2;
+    inherit version;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/fatsort/fatsort-Makefiles.patch b/nixpkgs/pkgs/tools/filesystems/fatsort/fatsort-Makefiles.patch
new file mode 100644
index 000000000000..51775edfb41d
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/fatsort/fatsort-Makefiles.patch
@@ -0,0 +1,34 @@
+diff -uNr fatsort-1.6.2.605.orig/Makefile fatsort-1.6.2.605.new/Makefile
+--- fatsort-1.6.2.605.orig/Makefile	2019-11-16 16:40:27.000000000 +0100
++++ fatsort-1.6.2.605.new/Makefile	2020-05-10 21:34:34.820874026 +0200
+@@ -1,4 +1,5 @@
+-MANDIR=/usr/local/share/man/man1
++PREFIX?=/usr/local
++MANDIR=$(PREFIX)/share/man/man1
+ 
+ INSTALL_FLAGS=-m 0755 -p -D
+ 
+diff -uNr fatsort-1.6.2.605.orig/src/Makefile fatsort-1.6.2.605.new/src/Makefile
+--- fatsort-1.6.2.605.orig/src/Makefile	2018-11-17 00:40:59.000000000 +0100
++++ fatsort-1.6.2.605.new/src/Makefile	2020-05-10 21:33:52.053391027 +0200
+@@ -30,7 +30,7 @@
+ 		override CFLAGS += -D __CYGWIN__
+ 		override CFLAGS += -D __LINUX__
+ 		override LDFLAGS += -liconv
+-		SBINDIR=/usr/local/sbin
++		SBINDIR=$(PREFIX)/sbin
+ 	endif
+ else
+ 	ifdef MINGW
+@@ -60,9 +60,9 @@
+ 			# OS X's install does not support the '-D' flag.
+ 			INSTALL_FLAGS=-m 0755 -p
+ 			# Mac OS X does not have a "/usr/local/sbin"
+-			SBINDIR=/usr/local/bin
++			SBINDIR=$(PREFIX)/bin
+ 		else
+-			SBINDIR=/usr/local/sbin
++			SBINDIR=$(PREFIX)/sbin
+ 		endif
+ 	endif
+ endif
diff --git a/nixpkgs/pkgs/tools/filesystems/file-rename/default.nix b/nixpkgs/pkgs/tools/filesystems/file-rename/default.nix
new file mode 100644
index 000000000000..6ddf5d788633
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/file-rename/default.nix
@@ -0,0 +1,32 @@
+{ lib, stdenv, fetchurl, perlPackages, makeWrapper }:
+
+perlPackages.buildPerlPackage {
+  pname = "File-Rename";
+  version = "0.20";
+
+  src = fetchurl {
+    url = "mirror://cpan/authors/id/R/RM/RMBARKER/File-Rename-0.20.tar.gz";
+    sha256 = "1cf6xx2hiy1xalp35fh8g73j67r0w0g66jpcbc6971x9jbm7bvjy";
+  };
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  # Fix an incorrect platform test that misidentifies Darwin as Windows
+  postPatch = ''
+    substituteInPlace Makefile.PL \
+      --replace '/win/i' '/MSWin32/'
+  '';
+
+  postInstall = ''
+    wrapProgram $out/bin/rename \
+      --prefix PERL5LIB : $out/${perlPackages.perl.libPrefix}
+  '';
+
+  doCheck = !stdenv.isDarwin;
+
+  meta = with lib; {
+    description = "Perl extension for renaming multiple files";
+    license = licenses.artistic1;
+    maintainers = with maintainers; [ peterhoeg ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/fsfs/default.nix b/nixpkgs/pkgs/tools/filesystems/fsfs/default.nix
new file mode 100644
index 000000000000..114c83e84f4a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/fsfs/default.nix
@@ -0,0 +1,30 @@
+{lib, stdenv, fetchurl, openssl, fuse}:
+
+throw "It still does not build"
+
+stdenv.mkDerivation {
+  name = "fsfs-0.1.1";
+  src = fetchurl {
+    url = "mirror://sourceforge/fsfs/fsfs-0.1.1.tar.gz";
+    sha256 = "05wka9aq182li2r7gxcd8bb3rhpns7ads0k59v7w1jza60l57c74";
+  };
+
+  buildInputs = [ fuse openssl ];
+
+  patchPhase = ''
+    sed -i -e 's,CONFDIR=\(.*\),CONFDIR='$out/etc, \
+      -e 's,USERCONFPREFIX=\(.*\),USERCONFPREFIX='$out/var/lib, Makefile \
+      src/Makefile src/utils/Makefile
+  '';
+
+  preInstall = ''
+    mkdir -p $out/etc $out/var/lib
+    makeFlags="$makeFlags prefix=$out"
+  '';
+
+  meta = {
+    homepage = "http://fsfs.sourceforge.net/";
+    description = "Secure distributed file system in user space";
+    license = lib.licenses.gpl2Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/fuse-7z-ng/default.nix b/nixpkgs/pkgs/tools/filesystems/fuse-7z-ng/default.nix
new file mode 100644
index 000000000000..aaffc70e10dd
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/fuse-7z-ng/default.nix
@@ -0,0 +1,40 @@
+{ lib, stdenv, fetchFromGitHub, fuse, p7zip, autoconf, automake, pkg-config, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  pname = "fuse-7z-ng";
+  version = "git-2014-06-08";
+
+  src = fetchFromGitHub {
+    owner = "kedazo";
+    repo = pname;
+    rev = "eb5efb1f304c2b7bc2e0389ba06c9bf2ac4b932c";
+    sha256 = "17v1gcmg5q661b047zxjar735i4d3508dimw1x3z1pk4d1zjhp3x";
+  };
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ fuse autoconf automake makeWrapper ];
+
+  preConfigure = "./autogen.sh";
+
+  libs = lib.makeLibraryPath [ p7zip ]; # 'cause 7z.so is loaded manually
+  postInstall = ''
+    wrapProgram $out/bin/${pname} --suffix LD_LIBRARY_PATH : "${libs}/p7zip"
+
+    mkdir -p $out/share/doc/${pname}
+    cp TODO README NEWS COPYING ChangeLog AUTHORS $out/share/doc/${pname}/
+  '';
+
+  meta = with lib; {
+    inherit version;
+    inherit (src.homepage);
+    description = "A FUSE-based filesystem that uses the p7zip library";
+    longDescription = ''
+      fuse-7z-ng is a FUSE file system that uses the p7zip
+      library to access all archive formats supported by 7-zip.
+
+      This project is a fork of fuse-7z ( https://gitorious.org/fuse-7z/fuse-7z ).
+    '';
+    platforms = platforms.linux;
+    license = licenses.gpl3Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/fuse-overlayfs/default.nix b/nixpkgs/pkgs/tools/filesystems/fuse-overlayfs/default.nix
new file mode 100644
index 000000000000..5522b63922a4
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/fuse-overlayfs/default.nix
@@ -0,0 +1,28 @@
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, fuse3, nixosTests }:
+
+stdenv.mkDerivation rec {
+  pname = "fuse-overlayfs";
+  version = "1.4.0";
+
+  src = fetchFromGitHub {
+    owner = "containers";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "sha256-lus+1hkc4GxrTxtdfDJ0XqJp37dcjKp4/sI3CEh8cYA=";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkg-config ];
+
+  buildInputs = [ fuse3 ];
+
+  passthru.tests = { inherit (nixosTests) podman; };
+
+  meta = with lib; {
+    description = "FUSE implementation for overlayfs";
+    longDescription = "An implementation of overlay+shiftfs in FUSE for rootless containers.";
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ ma9e ] ++ teams.podman.members;
+    platforms = platforms.linux;
+    inherit (src.meta) homepage;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/fuseiso/default.nix b/nixpkgs/pkgs/tools/filesystems/fuseiso/default.nix
new file mode 100644
index 000000000000..7e44e7c15f9c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/fuseiso/default.nix
@@ -0,0 +1,55 @@
+{ lib, stdenv, fetchurl, fetchpatch, autoreconfHook, pkg-config, fuse, glib, zlib }:
+
+stdenv.mkDerivation rec {
+  pname = "fuseiso";
+  version = "20070708";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/project/fuseiso/fuseiso/${version}/fuseiso-${version}.tar.bz2";
+    sha256 = "127xql52dcdhmh7s5m9xc6q39jdlj3zhbjar1j821kb6gl3jw94b";
+  };
+
+  patches = [
+    (fetchpatch {
+      name = "00-support_large_iso.patch";
+      url = "https://sources.debian.net/data/main/f/fuseiso/${version}-3.2/debian/patches/00-support_large_iso.patch";
+      sha256 = "1lmclb1qwzz5f4wlq693g83bblwnjjl73qhgfxbsaac5hnn2shjw";
+    })
+    (fetchpatch {
+      name = "01-fix_typo.patch";
+      url = "https://sources.debian.net/data/main/f/fuseiso/${version}-3.2/debian/patches/01-fix_typo.patch";
+      sha256 = "14rpxp0yylzsgqv0r19l4wx1h5hvqp617gpv1yg0w48amr9drasa";
+    })
+    (fetchpatch {
+      name = "02-prevent-buffer-overflow_CVE-2015-8837.patch";
+      url = "https://sources.debian.net/data/main/f/fuseiso/${version}-3.2/debian/patches/02-prevent-buffer-overflow.patch";
+      sha256 = "1ls2pp3mh91pdb51qz1fsd8pwhbky6988bpd156bn7wgfxqzh8ig";
+    })
+    (fetchpatch {
+      name = "03-prevent-integer-overflow_CVE-2015-8836.patch";
+      url = "https://sources.debian.net/data/main/f/fuseiso/${version}-3.2/debian/patches/03-prevent-integer-overflow.patch";
+      sha256 = "100cw07fk4sa3hl7a1gk2hgz4qsxdw99y20r7wpidwwwzy463zcv";
+    })
+  ];
+
+  nativeBuildInputs = [ autoreconfHook pkg-config ];
+
+  buildInputs = [ fuse glib zlib ];
+
+  # after autoreconfHook, glib and zlib are not found, so force link against
+  # them
+  NIX_LDFLAGS = "-lglib-2.0 -lz";
+
+  enableParallelBuilding = true;
+
+  postInstall = ''
+    install -Dm444 -t $out/share/doc/${pname} NEWS README
+  '';
+
+  meta = with lib; {
+    description = "FUSE module to mount ISO filesystem images";
+    homepage = "https://sourceforge.net/projects/fuseiso";
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/gcsfuse/default.nix b/nixpkgs/pkgs/tools/filesystems/gcsfuse/default.nix
new file mode 100644
index 000000000000..d820e5e68e2a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/gcsfuse/default.nix
@@ -0,0 +1,32 @@
+{ lib, buildGoPackage, fetchFromGitHub }:
+
+buildGoPackage rec {
+  pname = "gcsfuse";
+  version = "0.32.0";
+
+  src = fetchFromGitHub {
+    owner = "googlecloudplatform";
+    repo = "gcsfuse";
+    rev = "v${version}";
+    sha256 = "09k7479gd9rlzmxhcvc1b3ajy8frzd6881vnlvk3z9818n4aq7qc";
+  };
+
+  goPackagePath = "github.com/googlecloudplatform/gcsfuse";
+
+  subPackages = [ "." "tools/mount_gcsfuse" ];
+
+  postInstall = ''
+    ln -s $out/bin/mount_gcsfuse $out/bin/mount.gcsfuse
+    ln -s $out/bin/mount_gcsfuse $out/bin/mount.fuse.gcsfuse
+  '';
+
+  buildFlagsArray = [ "-ldflags=-s -w -X main.gcsfuseVersion=${version}" ];
+
+  meta = with lib;{
+    description = "A user-space file system for interacting with Google Cloud Storage";
+    homepage = "https://cloud.google.com/storage/docs/gcs-fuse";
+    license = licenses.asl20;
+    platforms = platforms.unix;
+    maintainers = [];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/genext2fs/default.nix b/nixpkgs/pkgs/tools/filesystems/genext2fs/default.nix
new file mode 100644
index 000000000000..ccc048f75723
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/genext2fs/default.nix
@@ -0,0 +1,24 @@
+{ lib, stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+  name = "genext2fs-1.4.1";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/genext2fs/genext2fs-1.4.1.tar.gz";
+    sha256 = "1z7czvsf3ircvz2cw1cf53yifsq29ljxmj15hbgc79l6gbxbnka0";
+  };
+
+  # https://sourceforge.net/p/genext2fs/bugs/2/
+  # Will be fixed in the next release, whenever this happens
+  postPatch = ''
+    sed -e 's@4 [*] (EXT2_TIND_BLOCK+1)@-1+&@' -i genext2fs.c
+  '';
+
+  meta = with lib; {
+    homepage = "http://genext2fs.sourceforge.net/";
+    description = "A tool to generate ext2 filesystem images without requiring root privileges";
+    license = licenses.gpl2;
+    platforms = platforms.all;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/genimage/default.nix b/nixpkgs/pkgs/tools/filesystems/genimage/default.nix
new file mode 100644
index 000000000000..b3ca1ae8394b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/genimage/default.nix
@@ -0,0 +1,30 @@
+{ lib, stdenv, fetchurl, pkg-config, libconfuse, gettext }:
+
+stdenv.mkDerivation rec {
+  pname = "genimage";
+  version = "9";
+
+  src = fetchurl {
+    url = "https://public.pengutronix.de/software/genimage/genimage-${version}.tar.xz";
+    sha256 = "0y4h8x8lqxam8m90rdfq8cg5137kvilxr3d1qzddpx7nxpvmmwv9";
+  };
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ libconfuse gettext ];
+
+  postInstall = ''
+    # As there is no manpage or built-in --help, add the README file for
+    # documentation.
+    docdir="$out/share/doc/genimage"
+    mkdir -p "$docdir"
+    cp -v README "$docdir"
+  '';
+
+  meta = with lib; {
+    homepage = "https://git.pengutronix.de/cgit/genimage";
+    description = "Generate filesystem images from directory trees";
+    license = licenses.gpl2Plus;
+    platforms = platforms.all;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/genromfs/default.nix b/nixpkgs/pkgs/tools/filesystems/genromfs/default.nix
new file mode 100644
index 000000000000..205d84791ec9
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/genromfs/default.nix
@@ -0,0 +1,25 @@
+{ lib, stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  version = "0.5.2";
+  pname = "genromfs";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/romfs/genromfs/${version}/${pname}-${version}.tar.gz";
+    sha256 = "0q6rpq7cmclmb4ayfyknvzbqysxs4fy8aiahlax1sb2p6k3pzwrh";
+  };
+
+  postPatch = ''
+    substituteInPlace Makefile \
+      --replace "prefix = /usr" "prefix = $out" \
+      --replace "gcc" "cc"
+  '';
+
+  meta = with lib; {
+    homepage = "http://romfs.sourceforge.net/";
+    description = "Tool for creating romfs file system images";
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/gitfs/default.nix b/nixpkgs/pkgs/tools/filesystems/gitfs/default.nix
new file mode 100644
index 000000000000..1d1863ede968
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/gitfs/default.nix
@@ -0,0 +1,37 @@
+{ lib, stdenv, fetchFromGitHub, python3Packages }:
+
+python3Packages.buildPythonApplication rec {
+  pname = "gitfs";
+  version = "0.5.2";
+
+  src = fetchFromGitHub {
+    owner = "PressLabs";
+    repo = "gitfs";
+    rev = version;
+    sha256 = "1jzwdwan8ndvp2lw6j7zbvg5k9rgf2d8dcxjrwc6bwyk59xdxn4p";
+  };
+
+  patchPhase = ''
+    # requirement checks are unnecessary at runtime
+    echo > requirements.txt
+  '';
+
+  checkInputs = with python3Packages; [ pytest pytestcov mock ];
+  propagatedBuildInputs = with python3Packages; [ atomiclong fusepy pygit2 six ];
+
+  checkPhase = "py.test";
+  doCheck = false;
+
+  meta = {
+    description = "A FUSE filesystem that fully integrates with git";
+    longDescription = ''
+      A git remote repository's branch can be mounted locally,
+      and any subsequent changes made to the files will be
+      automatically committed to the remote.
+    '';
+    homepage = "https://github.com/PressLabs/gitfs";
+    license = lib.licenses.asl20;
+    platforms = lib.platforms.linux;
+    maintainers = [ lib.maintainers.robbinch ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/glusterfs/default.nix b/nixpkgs/pkgs/tools/filesystems/glusterfs/default.nix
new file mode 100644
index 000000000000..a1e9fad45405
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/glusterfs/default.nix
@@ -0,0 +1,190 @@
+{lib, stdenv, fetchFromGitHub, fuse, bison, flex_2_5_35, openssl, python3, ncurses, readline,
+ autoconf, automake, libtool, pkg-config, zlib, libaio, libxml2, acl, sqlite,
+ liburcu, attr, makeWrapper, coreutils, gnused, gnugrep, which,
+ openssh, gawk, findutils, util-linux, lvm2, btrfs-progs, e2fsprogs, xfsprogs, systemd,
+ rsync, glibc, rpcsvc-proto, libtirpc
+}:
+let
+  # NOTE: On each glusterfs release, it should be checked if gluster added
+  #       new, or changed, Python scripts whose PYTHONPATH has to be set in
+  #       `postFixup` below, and whose runtime deps need to go into
+  #       `nativeBuildInputs`.
+  #       The command
+  #         find /nix/store/...-glusterfs-.../ -name '*.py' -executable
+  #       can help with finding new Python scripts.
+
+  buildInputs = [
+    fuse bison flex_2_5_35 openssl ncurses readline
+    autoconf automake libtool pkg-config zlib libaio libxml2
+    acl sqlite liburcu attr makeWrapper util-linux libtirpc
+    (python3.withPackages (pkgs: [
+      pkgs.flask
+      pkgs.prettytable
+      pkgs.requests
+      pkgs.pyxattr
+    ]))
+    # NOTE: `python3` has to be *AFTER* the above `python3.withPackages`,
+    #       to ensure that the packages are available but the `toPythonPath`
+    #       shell function used in `postFixup` is also still available.
+    python3
+  ];
+  # Some of the headers reference acl
+  propagatedBuildInputs = [
+    acl
+  ];
+  # Packages from which GlusterFS calls binaries at run-time from PATH,
+  # with comments on which commands are known to be called by it.
+  runtimePATHdeps = [
+    attr # getfattr setfattr
+    btrfs-progs # btrfs
+    coreutils # lots of commands in bash scripts
+    e2fsprogs # tune2fs
+    findutils # find
+    gawk # awk
+    glibc # getent
+    gnugrep # grep
+    gnused # sed
+    lvm2 # lvs
+    openssh # ssh
+    rsync # rsync, e.g. for geo-replication
+    systemd # systemctl
+    util-linux # mount umount
+    which # which
+    xfsprogs # xfs_info
+  ];
+in stdenv.mkDerivation rec {
+  pname = "glusterfs";
+  version = "8.3";
+
+  src = fetchFromGitHub {
+    owner = "gluster";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "09vvbymiacz2pzwnq6f2dd7g2zszzsivdncz45sh977v3z0n84az";
+  };
+  inherit buildInputs propagatedBuildInputs;
+
+  postPatch = ''
+    sed -e '/chmod u+s/d' -i contrib/fuse-util/Makefile.am
+    substituteInPlace libglusterfs/src/glusterfs/lvm-defaults.h \
+      --replace '/sbin/' '${lvm2}/bin/'
+    substituteInPlace libglusterfs/src/glusterfs/compat.h \
+      --replace '/bin/umount' '${util-linux}/bin/umount'
+    substituteInPlace contrib/fuse-lib/mount-gluster-compat.h \
+      --replace '/bin/mount' '${util-linux}/bin/mount'
+  '';
+
+  # Note that the VERSION file is something that is present in release tarballs
+  # but not in git tags (at least not as of writing in v3.10.1).
+  # That's why we have to create it.
+  # Without this, gluster (at least 3.10.1) will fail very late and cryptically,
+  # for example when setting up geo-replication, with a message like
+  #   Staging of operation 'Volume Geo-replication Create' failed on localhost : Unable to fetch master volume details. Please check the master cluster and master volume.
+  # What happens here is that the gverify.sh script tries to compare the versions,
+  # but fails when the version is empty.
+  # See upstream GlusterFS bug https://bugzilla.redhat.com/show_bug.cgi?id=1452705
+  preConfigure = ''
+    echo "v${version}" > VERSION
+    ./autogen.sh
+    export PYTHON=${python3}/bin/python
+    '';
+
+  configureFlags = [
+    "--localstatedir=/var"
+    ];
+
+  nativeBuildInputs = [ rpcsvc-proto ];
+
+  makeFlags = [ "DESTDIR=$(out)" ];
+
+  enableParallelBuilding = true;
+
+  postInstall = ''
+    cp -r $out/$out/* $out
+    rm -r $out/nix
+  '';
+
+  postFixup = ''
+    # glusterd invokes `gluster` and other utilities when telling other glusterd nodes to run commands.
+    # For example for `peer_georep-sshkey` key generation, so `$out/bin` is needed in the PATH.
+    # It also invokes bash scripts like `gverify.sh`.
+    # It also invokes executable Python scripts in `$out/libexec/glusterfs`, which is why we set up PYTHONPATH accordingly.
+    # We set up the paths for the main entry point executables.
+
+    GLUSTER_PATH="${lib.makeBinPath runtimePATHdeps}:$out/bin"
+    GLUSTER_PYTHONPATH="$(toPythonPath $out):$out/libexec/glusterfs"
+    GLUSTER_LD_LIBRARY_PATH="$out/lib"
+
+    wrapProgram $out/bin/glusterd --set PATH "$GLUSTER_PATH" --set PYTHONPATH "$GLUSTER_PYTHONPATH" --set LD_LIBRARY_PATH "$GLUSTER_LD_LIBRARY_PATH"
+    wrapProgram $out/bin/gluster --set PATH "$GLUSTER_PATH" --set PYTHONPATH "$GLUSTER_PYTHONPATH" --set LD_LIBRARY_PATH "$GLUSTER_LD_LIBRARY_PATH"
+    wrapProgram $out/sbin/mount.glusterfs --set PATH "$GLUSTER_PATH" --set PYTHONPATH "$GLUSTER_PYTHONPATH" --set LD_LIBRARY_PATH "$GLUSTER_LD_LIBRARY_PATH"
+
+    # Set Python environment for the Python based utilities.
+    # It would be nice if there was a better way to do this, automatically for all of them.
+    # Also, this is brittle: If we forget a dependency or gluster adds a new one, things will break deep inside gluster.
+    # We should better try to get an explicit list of Python dependencies from gluster and ensure all of them are in the PYTHONPATH of all these python scripts.
+    # But at the time of writing (gluster 3.10), gluster only provides this in form of a gluster.spec file for RPM creation,
+    # and even that one is not complete (for example it doesn't mention the `flask` dependency).
+
+    wrapProgram $out/bin/gluster-eventsapi --set PATH "$GLUSTER_PATH" --set PYTHONPATH "$GLUSTER_PYTHONPATH" --set LD_LIBRARY_PATH "$GLUSTER_LD_LIBRARY_PATH"
+    wrapProgram $out/bin/gluster-georep-sshkey --set PATH "$GLUSTER_PATH" --set PYTHONPATH "$GLUSTER_PYTHONPATH" --set LD_LIBRARY_PATH "$GLUSTER_LD_LIBRARY_PATH"
+    wrapProgram $out/bin/gluster-mountbroker --set PATH "$GLUSTER_PATH" --set PYTHONPATH "$GLUSTER_PYTHONPATH" --set LD_LIBRARY_PATH "$GLUSTER_LD_LIBRARY_PATH"
+    wrapProgram $out/bin/glusterfind --set PATH "$GLUSTER_PATH" --set PYTHONPATH "$GLUSTER_PYTHONPATH" --set LD_LIBRARY_PATH "$GLUSTER_LD_LIBRARY_PATH"
+
+    # Note that we only wrap the symlinks in $out/bin, not the actual executable scripts in $out/libexec/glusterfs.
+    # This is because those scripts use `__file__` in their program logic
+    # (see https://github.com/gluster/glusterfs/blob/v3.10.1/extras/cliutils/cliutils.py#L116)
+    # which would break if we changed the file name (which is what `wrapProgram` does).
+    # Luckily, `libexec` scripts are never supposed to be invoked straight from PATH,
+    # instead they are invoked directly from `gluster` or `glusterd`, which is why it is
+    # sufficient to set PYTHONPATH for those executables.
+    #
+    # Exceptions to these rules are the `glusterfind` `brickfind.py` and `changelog.py`
+    # crawlers, which are directly invoked on other gluster nodes using a remote SSH command
+    # issues by `glusterfind`.
+
+    wrapProgram $out/share/glusterfs/scripts/eventsdash.py --set PATH "$GLUSTER_PATH" --set PYTHONPATH "$GLUSTER_PYTHONPATH" --set LD_LIBRARY_PATH "$GLUSTER_LD_LIBRARY_PATH"
+    wrapProgram $out/libexec/glusterfs/glusterfind/brickfind.py --set PATH "$GLUSTER_PATH" --set PYTHONPATH "$GLUSTER_PYTHONPATH" --set LD_LIBRARY_PATH "$GLUSTER_LD_LIBRARY_PATH"
+    wrapProgram $out/libexec/glusterfs/glusterfind/changelog.py --set PATH "$GLUSTER_PATH" --set PYTHONPATH "$GLUSTER_PYTHONPATH" --set LD_LIBRARY_PATH "$GLUSTER_LD_LIBRARY_PATH"
+  '';
+
+  doInstallCheck = true;
+
+  # Below we run Python programs. That generates .pyc/.pyo files.
+  # By default they are indeterministic because such files contain time stamps
+  # (see https://nedbatchelder.com/blog/200804/the_structure_of_pyc_files.html).
+  # So we use the same environment variables as in
+  #   https://github.com/NixOS/nixpkgs/blob/249b34aadca7038207492f29142a3456d0cecec3/pkgs/development/interpreters/python/mk-python-derivation.nix#L61
+  # to make these files deterministic.
+  # A general solution to this problem might be brought by #25707.
+  DETERMINISTIC_BUILD = 1;
+  PYTHONHASHSEED = 0;
+
+  installCheckPhase = ''
+    # Tests that the above programs work without import errors.
+    # For testing it manually in a shell you may want to substitute `$out` with `$(dirname $(readlink -f $(which gluster)))/../`.
+    $out/bin/glusterd --help
+    # $out/bin/gluster help # can't do this because even `gluster help` tries to write to `/var/log/glusterfs/cli.log`
+    $out/bin/gluster-eventsapi --help
+    $out/bin/gluster-georep-sshkey --help
+    $out/bin/gluster-mountbroker --help
+    $out/bin/glusterfind --help
+    # gfid_to_path.py doesn't accept --help, and it requires different arguments
+    # (a dir as single argument) than the usage prints when stdin is not a TTY.
+    # The `echo ""` is just so that stdin is not a TTY even if you try this line
+    # on a real TTY for testing purposes.
+    echo "" | (mkdir -p nix-test-dir-for-gfid_to_path && touch b && $out/libexec/glusterfs/gfind_missing_files/gfid_to_path.py nix-test-dir-for-gfid_to_path)
+    $out/share/glusterfs/scripts/eventsdash.py --help
+
+    # this gets falsely loaded as module by glusterfind
+    rm -r $out/bin/conf.py
+    '';
+
+  meta = with lib; {
+    description = "Distributed storage system";
+    homepage = "https://www.gluster.org";
+    license = licenses.lgpl3Plus; # dual licese: choice of lgpl3Plus or gpl2
+    maintainers = [ maintainers.raskin ];
+    platforms = with platforms; linux ++ freebsd;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/go-mtpfs/default.nix b/nixpkgs/pkgs/tools/filesystems/go-mtpfs/default.nix
new file mode 100644
index 000000000000..bd6e0fe67fc2
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/go-mtpfs/default.nix
@@ -0,0 +1,20 @@
+{ pkg-config, libusb1, buildGoPackage, fetchgit }:
+
+buildGoPackage rec {
+  pname = "go-mtpfs";
+  version = "2018-02-09";
+  rev = "d6f8f3c05ce0ed31435057ec342268a0735863bb";
+
+  goPackagePath = "github.com/hanwen/go-mtpfs";
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ libusb1 ];
+
+  src = fetchgit {
+    inherit rev;
+    url = "https://github.com/hanwen/go-mtpfs";
+    sha256 = "0a0d5dy92nzp1czh87hx3xfdcpa4jh14j0b64c025ha62s9a4gxk";
+  };
+
+  goDeps = ./deps.nix;
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/go-mtpfs/deps.nix b/nixpkgs/pkgs/tools/filesystems/go-mtpfs/deps.nix
new file mode 100644
index 000000000000..f558a53f7d2d
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/go-mtpfs/deps.nix
@@ -0,0 +1,30 @@
+# This file was generated by https://github.com/kamilchm/go2nix v1.3.0
+[
+  {
+    goPackagePath = "github.com/hanwen/go-fuse";
+    fetch = {
+      type = "git";
+      url = "https://github.com/hanwen/go-fuse";
+      rev = "d1c826d19ad0c8d0c7e5b4eb34ee0f2ae09f6cef";
+      sha256 = "0hn2iqsb6rip2b05fvcngyh0sazln2h3fx18khq4fv41n1iy11dc";
+    };
+  }
+  {
+    goPackagePath = "github.com/hanwen/usb";
+    fetch = {
+      type = "git";
+      url = "https://github.com/hanwen/usb";
+      rev = "69aee4530ac705cec7c5344418d982aaf15cf0b1";
+      sha256 = "01k0c2g395j65vm1w37mmrfkg6nm900khjrrizzpmx8f8yf20dky";
+    };
+  }
+  {
+    goPackagePath = "golang.org/x/sys";
+    fetch = {
+      type = "git";
+      url = "https://go.googlesource.com/sys";
+      rev = "48ac38b7c8cbedd50b1613c0fccacfc7d88dfcdf";
+      sha256 = "037vs8sdvq310j3b6z9k62zlby1mzmsr9ha01rcy98dv5v8bkhin";
+    };
+  }
+]
diff --git a/nixpkgs/pkgs/tools/filesystems/gocryptfs/default.nix b/nixpkgs/pkgs/tools/filesystems/gocryptfs/default.nix
new file mode 100644
index 000000000000..318e39e8322e
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/gocryptfs/default.nix
@@ -0,0 +1,51 @@
+{ lib, stdenv
+, buildGoModule
+, fetchFromGitHub
+, openssl
+, pandoc
+, pkg-config
+}:
+
+buildGoModule rec {
+  pname = "gocryptfs";
+  version = "1.8.0";
+
+  src = fetchFromGitHub {
+    owner = "rfjakob";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "1acalwrr5xqhpqca3gypj0s68w6vpckxmg5z5gfgh8wx6nqx4aw9";
+  };
+
+  runVend = true;
+  vendorSha256 = "0z3y51sgr1rmr23jpc5h5d5lw14p3qzv48rc7zj7qa4rd5cfhsgi";
+
+  nativeBuildInputs = [ pandoc pkg-config ];
+  buildInputs = [ openssl ];
+
+  buildFlagsArray = ''
+    -ldflags=
+      -X main.GitVersion=${version}
+      -X main.GitVersionFuse=[vendored]
+      -X main.BuildDate=unknown
+  '';
+
+  subPackages = [ "." "gocryptfs-xray" "contrib/statfs" ];
+
+  postBuild = ''
+    pushd Documentation/
+    mkdir -p $out/share/man/man1
+    pandoc MANPAGE.md -s -t man -o $out/share/man/man1/gocryptfs.1
+    pandoc MANPAGE-XRAY.md -s -t man -o $out/share/man/man1/gocryptfs-xray.1
+    pandoc MANPAGE-STATFS.md -s -t man -o $out/share/man/man1/statfs.1
+    popd
+  '';
+
+  meta = with lib; {
+    description = "Encrypted overlay filesystem written in Go";
+    license = licenses.mit;
+    homepage = "https://nuetzlich.net/gocryptfs/";
+    maintainers = with maintainers; [ flokli offline prusnak ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/gpart/default.nix b/nixpkgs/pkgs/tools/filesystems/gpart/default.nix
new file mode 100644
index 000000000000..eafbe066ac94
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/gpart/default.nix
@@ -0,0 +1,33 @@
+{ lib, stdenv, fetchFromGitHub, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  pname = "gpart";
+  version = "0.3";
+
+  # GitHub repository 'collating patches for gpart from all distributions':
+  src = fetchFromGitHub {
+    sha256 = "1lsd9k876p944k9s6sxqk5yh9yr7m42nbw9vlsllin7pd4djl4ya";
+    rev = version;
+    repo = "gpart";
+    owner = "baruch";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  enableParallelBuilding = true;
+
+  doCheck = true;
+
+  meta = with lib; {
+    inherit (src.meta) homepage;
+    description = "Guess PC-type hard disk partitions";
+    longDescription = ''
+      Gpart is a tool which tries to guess the primary partition table of a
+      PC-type hard disk in case the primary partition table in sector 0 is
+      damaged, incorrect or deleted. The guessed table can be written to a file
+      or device.
+    '';
+    license = licenses.gpl2Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/grive2/default.nix b/nixpkgs/pkgs/tools/filesystems/grive2/default.nix
new file mode 100644
index 000000000000..68475b9e2908
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/grive2/default.nix
@@ -0,0 +1,25 @@
+{ lib, stdenv, fetchFromGitHub, pkg-config, yajl, cmake, libgcrypt, curl, expat, boost, libiberty }:
+
+stdenv.mkDerivation rec {
+  version = "0.5.1";
+  pname = "grive2";
+
+  src = fetchFromGitHub {
+    owner = "vitalif";
+    repo = "grive2";
+    rev =  "v${version}";
+    sha256 = "1kv34ys8qarjsxpb1kd8dp7b3b4ycyiwjzd6mg97d3jk7405g6nm";
+  };
+
+  nativeBuildInputs = [ cmake pkg-config ];
+
+  buildInputs = [ libgcrypt yajl curl expat stdenv boost libiberty ];
+
+  meta = with lib; {
+    description = "A console Google Drive client";
+    homepage = "https://github.com/vitalif/grive2";
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+  };
+
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/hfsprogs/default.nix b/nixpkgs/pkgs/tools/filesystems/hfsprogs/default.nix
new file mode 100644
index 000000000000..8a2a8572b5ca
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/hfsprogs/default.nix
@@ -0,0 +1,49 @@
+{ lib, stdenv, fetchurl, openssl, libbsd }:
+
+let version = "332.25";
+    package_name = "hfsprogs"; in
+stdenv.mkDerivation {
+  name = "${package_name}-${version}";
+  srcs = [
+    (fetchurl {
+      url = "http://ftp.de.debian.org/debian/pool/main/h/hfsprogs/${package_name}_${version}-11.debian.tar.gz";
+      sha256 = "62d9b8599c66ebffbc57ce5d776e20b41341130d9b27341d63bda08460ebde7c";
+    })
+    (fetchurl {
+      url = "https://opensource.apple.com/tarballs/diskdev_cmds/diskdev_cmds-${version}.tar.gz";
+      sha256 = "74c9aeca899ed7f4bf155c65fc45bf0f250c0f6d57360ea953b1d536d9aa45e6";
+    })
+  ];
+
+  postPatch = ''
+    sed -ie '/sys\/sysctl.h/d' newfs_hfs.tproj/makehfs.c
+  '';
+
+  sourceRoot = "diskdev_cmds-" + version;
+  patches = [ "../debian/patches/*.patch" ];
+
+  buildInputs = [ openssl libbsd ];
+  makefile = "Makefile.lnx";
+
+  # Inspired by PKGBUILD of https://www.archlinux.org/packages/community/x86_64/hfsprogs/
+  installPhase = ''
+    # Create required package directories
+    install -m 755 -d "$out/bin"
+    install -m 755 -d "$out/share/${package_name}"
+    install -m 755 -d "$out/share/man/man8/"
+    # Copy executables
+    install -m 755 "newfs_hfs.tproj/newfs_hfs" "$out/bin/mkfs.hfsplus"
+    install -m 755 "fsck_hfs.tproj/fsck_hfs" "$out/bin/fsck.hfsplus"
+    # Copy shared data
+    install -m 644 "newfs_hfs.tproj/hfsbootdata.img" "$out/share/${package_name}/hfsbootdata"
+    # Copy man pages
+    install -m 644 "newfs_hfs.tproj/newfs_hfs.8" "$out/share/man/man8/mkfs.hfsplus.8"
+    install -m 644 "fsck_hfs.tproj/fsck_hfs.8" "$out/share/man/man8/fsck.hfsplus.8"
+  '';
+
+  meta = {
+    description = "HFS/HFS+ user space utils";
+    license = lib.licenses.apsl20;
+    platforms = lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/httpfs/default.nix b/nixpkgs/pkgs/tools/filesystems/httpfs/default.nix
new file mode 100644
index 000000000000..c62703c7b523
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/httpfs/default.nix
@@ -0,0 +1,35 @@
+{ fetchurl, lib, stdenv, pkg-config, fuse, openssl, asciidoc
+, docbook_xml_dtd_45, docbook_xsl , libxml2, libxslt }:
+
+stdenv.mkDerivation rec {
+  name = "httpfs2-0.1.5";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/httpfs/httpfs2/${name}.tar.gz";
+    sha256 = "1h8ggvhw30n2r6w11n1s458ypggdqx6ldwd61ma4yd7binrlpjq1";
+  };
+
+  buildInputs =
+    [ pkg-config fuse openssl
+      asciidoc docbook_xml_dtd_45 docbook_xsl libxml2 libxslt
+    ];
+
+  installPhase =
+    '' mkdir -p "$out/bin"
+       cp -v httpfs2 "$out/bin"
+
+       mkdir -p "$out/share/man/man1"
+       cp -v *.1 "$out/share/man/man1"
+    '';
+
+  meta = {
+    description = "FUSE-based HTTP filesystem for Linux";
+
+    homepage = "http://httpfs.sourceforge.net/";
+
+    license = lib.licenses.gpl2Plus;
+
+    platforms = lib.platforms.linux;
+    maintainers = [ ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/hubicfuse/default.nix b/nixpkgs/pkgs/tools/filesystems/hubicfuse/default.nix
new file mode 100644
index 000000000000..4f40bd37abeb
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/hubicfuse/default.nix
@@ -0,0 +1,29 @@
+{ lib, stdenv, fetchFromGitHub, pkg-config, curl, openssl, fuse, libxml2, json_c, file }:
+
+stdenv.mkDerivation rec {
+  pname = "hubicfuse";
+  version = "3.0.1";
+
+  src = fetchFromGitHub {
+    owner = "TurboGit";
+    repo = "hubicfuse";
+    rev = "v${version}";
+    sha256 = "1x988hfffxgvqxh083pv3lj5031fz03sbgiiwrjpaiywfbhm8ffr";
+  };
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ curl openssl fuse libxml2 json_c file ];
+  postInstall = ''
+    install hubic_token $out/bin
+    mkdir -p $out/sbin
+    ln -sf $out/bin/hubicfuse $out/sbin/mount.hubicfuse
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/TurboGit/hubicfuse";
+    description = "FUSE-based filesystem to access hubic cloud storage";
+    platforms = platforms.linux;
+    license = licenses.mit;
+    maintainers = [ maintainers.jpierre03 ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/idsk/default.nix b/nixpkgs/pkgs/tools/filesystems/idsk/default.nix
new file mode 100644
index 000000000000..12a0af7ea4d3
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/idsk/default.nix
@@ -0,0 +1,29 @@
+{ lib, stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+
+  pname = "idsk";
+  version = "0.20";
+
+  src = fetchFromGitHub {
+    repo = "idsk";
+    owner = "cpcsdk";
+    rev = "v${version}";
+    sha256 = "05zbdkb9s6sfkni6k927795w2fqdhnf3i7kgl27715sdmmdab05d";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp iDSK $out/bin
+  '';
+
+  meta = with lib; {
+    description = "Manipulating CPC dsk images and files";
+    homepage = "https://github.com/cpcsdk/idsk" ;
+    license = licenses.mit;
+    maintainers = [ ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/ifuse/default.nix b/nixpkgs/pkgs/tools/filesystems/ifuse/default.nix
new file mode 100644
index 000000000000..4abb50b8bd76
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/ifuse/default.nix
@@ -0,0 +1,29 @@
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, usbmuxd, fuse, libimobiledevice }:
+
+stdenv.mkDerivation rec {
+  pname = "ifuse";
+  version = "1.1.4";
+
+  src = fetchFromGitHub {
+    owner = "libimobiledevice";
+    repo = pname;
+    rev = version;
+    sha256 = "1r12y3h1j7ikkwk874h9969kr4ksyamvrwywx19ml6rsr01arw84";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkg-config fuse usbmuxd libimobiledevice ];
+
+  meta = with lib; {
+    homepage = "https://github.com/libimobiledevice/ifuse";
+    description = "A fuse filesystem implementation to access the contents of iOS devices";
+    longDescription = ''
+      Mount directories of an iOS device locally using fuse. By default the media
+      directory is mounted, options allow to also mount the sandbox container of an
+      app, an app's documents folder or even the root filesystem on jailbroken
+      devices.
+    '';
+    license = licenses.lgpl21Plus;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ infinisil ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/irods/common.nix b/nixpkgs/pkgs/tools/filesystems/irods/common.nix
new file mode 100644
index 000000000000..24697aaf8218
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/irods/common.nix
@@ -0,0 +1,55 @@
+{ stdenv, bzip2, zlib, autoconf, automake, cmake, gnumake, help2man , texinfo, libtool , cppzmq , libarchive, avro-cpp, boost, jansson, zeromq, openssl, pam, libiodbc, kerberos, gcc, libcxx, which, catch2 }:
+
+# Common attributes of irods packages
+
+with stdenv;
+
+{
+  nativeBuildInputs = [ autoconf automake cmake gnumake help2man texinfo which gcc ];
+  buildInputs = [ bzip2 zlib libtool cppzmq libarchive avro-cpp jansson zeromq openssl pam libiodbc kerberos boost libcxx catch2 ];
+
+  cmakeFlags = [
+    "-DIRODS_EXTERNALS_FULLPATH_CLANG=${stdenv.cc}"
+    "-DIRODS_EXTERNALS_FULLPATH_CLANG_RUNTIME=${stdenv.cc}"
+    "-DIRODS_EXTERNALS_FULLPATH_ARCHIVE=${libarchive.lib}"
+    "-DIRODS_EXTERNALS_FULLPATH_AVRO=${avro-cpp}"
+    "-DIRODS_EXTERNALS_FULLPATH_BOOST=${boost}"
+    "-DIRODS_EXTERNALS_FULLPATH_JANSSON=${jansson}"
+    "-DIRODS_EXTERNALS_FULLPATH_ZMQ=${zeromq}"
+    "-DIRODS_EXTERNALS_FULLPATH_CPPZMQ=${cppzmq}"
+    "-DIRODS_EXTERNALS_FULLPATH_CATCH2=${catch2}"
+    "-DIRODS_LINUX_DISTRIBUTION_NAME=nix"
+    "-DIRODS_LINUX_DISTRIBUTION_VERSION_MAJOR=${builtins.nixVersion}"
+    "-DCPACK_GENERATOR=TGZ"
+    "-DCMAKE_CXX_FLAGS=-I${libcxx}/include/c++/v1"
+  ];
+
+  preConfigure = ''
+    patchShebangs ./packaging
+    patchShebangs ./scripts
+    substituteInPlace CMakeLists.txt --replace "DESTINATION usr/bin" "DESTINATION bin"
+    substituteInPlace CMakeLists.txt --replace "INCLUDE_DIRS usr/include/" "INCLUDE_DIRS include/"
+    substituteInPlace CMakeLists.txt --replace "DESTINATION usr/lib/" "DESTINATION lib/"
+    export cmakeFlags="$cmakeFlags
+      -DCMAKE_INSTALL_PREFIX=$out
+    "
+  '';
+
+  meta = {
+    description = "Integrated Rule-Oriented Data System (iRODS)";
+    longDescription = ''
+      The Integrated Rule-Oriented Data System (iRODS) is open source data management
+      software used by research organizations and government agencies worldwide.
+      iRODS is released as a production-level distribution aimed at deployment in mission
+      critical environments.  It virtualizes data storage resources, so users can take
+      control of their data, regardless of where and on what device the data is stored.
+      As data volumes grow and data services become more complex, iRODS is increasingly
+      important in data management. The development infrastructure supports exhaustive
+      testing on supported platforms; plug-in support for microservices, storage resources,
+      drivers, and databases; and extensive documentation, training and support services.'';
+    homepage = "https://irods.org";
+    license = lib.licenses.bsd3;
+    maintainers = [ lib.maintainers.bzizou ];
+    platforms = lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/irods/default.nix b/nixpkgs/pkgs/tools/filesystems/irods/default.nix
new file mode 100644
index 000000000000..0dce22b8bbba
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/irods/default.nix
@@ -0,0 +1,99 @@
+{ stdenv, fetchFromGitHub, bzip2, zlib, autoconf, automake, cmake, gnumake, help2man , texinfo, libtool , cppzmq , libarchive, avro-cpp_llvm, boost, jansson, zeromq, openssl , pam, libiodbc, kerberos, gcc, libcxx, which, catch2 }:
+
+with stdenv;
+
+let
+  avro-cpp=avro-cpp_llvm;
+in
+let
+  common = import ./common.nix {
+    inherit stdenv bzip2 zlib autoconf automake cmake gnumake
+            help2man texinfo libtool cppzmq libarchive jansson
+            zeromq openssl pam libiodbc kerberos gcc libcxx
+            boost avro-cpp which catch2;
+  };
+in rec {
+
+  # irods: libs and server package
+  irods = stdenv.mkDerivation (common // rec {
+    version = "4.2.7";
+    pname = "irods";
+
+    src = fetchFromGitHub {
+      owner = "irods";
+      repo = "irods";
+      rev = version;
+      sha256 = "1pd4l42z4igzf0l8xbp7yz0nhzsv47ziv5qj8q1hh6pfhmwlzp9s";
+      fetchSubmodules = true;
+    };
+
+    # Patches:
+    # irods_root_path.patch : the root path is obtained by stripping 3 items of the path,
+    #                         but we don't use /usr with nix, so remove only 2 items.
+    patches = [ ./irods_root_path.patch ];
+
+    # fix build with recent llvm versions
+    NIX_CFLAGS_COMPILE = "-Wno-deprecated-register -Wno-deprecated-declarations";
+
+    preConfigure = common.preConfigure + ''
+      patchShebangs ./test
+      substituteInPlace plugins/database/CMakeLists.txt --replace "COMMAND cpp" "COMMAND ${gcc.cc}/bin/cpp"
+      substituteInPlace cmake/server.cmake --replace "DESTINATION usr/sbin" "DESTINATION sbin"
+      substituteInPlace cmake/server.cmake --replace "IRODS_DOC_DIR usr/share" "IRODS_DOC_DIR share"
+      substituteInPlace cmake/runtime_library.cmake --replace "DESTINATION usr/lib" "DESTINATION lib"
+      substituteInPlace cmake/development_library.cmake --replace "DESTINATION usr/lib" "DESTINATION lib"
+      substituteInPlace cmake/development_library.cmake --replace "DESTINATION usr/include" "DESTINATION include"
+      for file in unit_tests/cmake/test_config/*.cmake
+      do
+        substituteInPlace $file --replace "CATCH2}/include" "CATCH2}/include/catch2"
+      done
+      export cmakeFlags="$cmakeFlags
+        -DCMAKE_EXE_LINKER_FLAGS=-Wl,-rpath,$out/lib
+        -DCMAKE_MODULE_LINKER_FLAGS=-Wl,-rpath,$out/lib
+        -DCMAKE_SHARED_LINKER_FLAGS=-Wl,-rpath,$out/lib
+        "
+
+      substituteInPlace cmake/server.cmake --replace SETUID ""
+    '';
+
+    meta = common.meta // {
+      longDescription = common.meta.longDescription + "This package provides the servers and libraries.";
+    };
+  });
+
+
+  # icommands (CLI) package, depends on the irods package
+  irods-icommands = stdenv.mkDerivation (common // rec {
+     version = "4.2.7";
+     pname = "irods-icommands";
+
+     src = fetchFromGitHub {
+       owner = "irods";
+       repo = "irods_client_icommands";
+       rev = version;
+       sha256 = "08hqrc9iaw0y9rrrcknnl5mzbcrsvqc39pwvm62fipl3vnfqryli";
+     };
+
+     patches = [ ./zmqcpp-deprecated-send_recv.patch ];
+
+     buildInputs = common.buildInputs ++ [ irods ];
+
+     preConfigure = common.preConfigure + ''
+       patchShebangs ./bin
+     '';
+
+     cmakeFlags = common.cmakeFlags ++ [
+       "-DCMAKE_INSTALL_PREFIX=${out}"
+       "-DIRODS_DIR=${irods}/lib/irods/cmake"
+       "-DCMAKE_EXE_LINKER_FLAGS=-Wl,-rpath,${irods}/lib"
+       "-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-rpath,${irods}/lib"
+       "-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-rpath,${irods}/lib"
+    ];
+
+     meta = common.meta // {
+       description = common.meta.description + " CLI clients";
+       longDescription = common.meta.longDescription + "This package provides the CLI clients, called 'icommands'.";
+     };
+  });
+}
+
diff --git a/nixpkgs/pkgs/tools/filesystems/irods/irods_root_path.patch b/nixpkgs/pkgs/tools/filesystems/irods/irods_root_path.patch
new file mode 100644
index 000000000000..16b6ba08cbb2
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/irods/irods_root_path.patch
@@ -0,0 +1,71 @@
+diff -r -u irods-4.2.0.orig/lib/core/src/irods_default_paths.cpp irods-4.2.0/lib/core/src/irods_default_paths.cpp
+--- irods-4.2.0.orig/lib/core/src/irods_default_paths.cpp	2016-11-15 06:23:55.000000000 +0000
++++ irods-4.2.0/lib/core/src/irods_default_paths.cpp	2016-12-20 18:03:17.156883399 +0000
+@@ -18,7 +18,7 @@
+         try {
+             boost::filesystem::path path{dl_info.dli_fname};
+             path = boost::filesystem::canonical(path);
+-            path.remove_filename().remove_filename().remove_filename(); // Removes filename and the two directories (usr and lib) between libirods_common.so and base of irods install
++            path.remove_filename().remove_filename(); // Removes filename and the two directories (usr and lib) between libirods_common.so and base of irods install
+             return path;
+         } catch(const boost::filesystem::filesystem_error& e) {
+             THROW(-1, e.what());
+@@ -27,8 +27,7 @@
+ 
+     boost::filesystem::path
+     get_irods_config_directory() {
+-        boost::filesystem::path path{get_irods_root_directory()};
+-        path.append("etc").append("irods");
++        boost::filesystem::path path("/etc/irods");
+         return path;
+     }
+ 
+diff -r -u irods-4.2.0.orig/scripts/irods/paths.py irods-4.2.0/scripts/irods/paths.py
+--- irods-4.2.0.orig/scripts/irods/paths.py	2016-11-15 06:23:55.000000000 +0000
++++ irods-4.2.0/scripts/irods/paths.py	2016-12-21 15:17:07.437864606 +0000
+@@ -10,7 +10,7 @@
+     return os.path.join(root_directory(), 'var', 'lib', 'irods')
+ 
+ def config_directory():
+-    return os.path.join(root_directory(), 'etc', 'irods')
++    return os.path.join(os.path.abspath('/'), 'etc', 'irods')
+ 
+ def plugins_directory():
+     return os.path.join(root_directory(), 'usr', 'lib', 'irods', 'plugins')
+@@ -37,7 +37,7 @@
+ 
+ def version_path():
+     return os.path.join(
+-        irods_directory(),
++        home_directory(),
+         'VERSION.json')
+ 
+ def hosts_config_path():
+@@ -64,7 +64,7 @@
+ 
+ def log_directory():
+     return os.path.join(
+-        irods_directory(),
++        home_directory(),
+         'log')
+ 
+ def control_log_path():
+@@ -110,8 +110,7 @@
+ def server_bin_directory():
+     return os.path.join(
+         root_directory(),
+-        'usr',
+-        'sbin')
++        'bin')
+ 
+ def server_executable():
+     return os.path.join(
+@@ -132,7 +131,7 @@
+     return os.path.join(config_directory(), 'service_account.config')
+ 
+ def genosauth_path():
+-    return os.path.join(irods_directory(), 'clients', 'bin', 'genOSAuth')
++    return os.path.join(home_directory(), 'clients', 'bin', 'genOSAuth')
+ 
+ def irods_user_and_group_entries():
+     try:
diff --git a/nixpkgs/pkgs/tools/filesystems/irods/zmqcpp-deprecated-send_recv.patch b/nixpkgs/pkgs/tools/filesystems/irods/zmqcpp-deprecated-send_recv.patch
new file mode 100644
index 000000000000..8c249dc4745b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/irods/zmqcpp-deprecated-send_recv.patch
@@ -0,0 +1,21 @@
+diff -r -u source/src/irods-grid.cpp source.new/src/irods-grid.cpp
+--- source/src/irods-grid.cpp	1970-01-01 01:00:01.000000000 +0100
++++ source.new/src/irods-grid.cpp	2020-05-05 16:34:35.566464346 +0200
+@@ -412,7 +412,7 @@
+             data_to_send.data(),
+             data_to_send.size() );
+         try {
+-            if (!zmq_skt.send(req)) {
++            if (!zmq_skt.send( req, zmq::send_flags::dontwait )) {
+                 std::cerr << "ZeroMQ encountered an error sending a message.\n";
+                 return errno;
+             }
+@@ -426,7 +426,7 @@
+         zmq::message_t rep;
+         // wait for the server reponse
+         try {
+-            if (!zmq_skt.recv( &rep )) {
++            if (!zmq_skt.recv( rep, zmq::recv_flags::dontwait )) {
+                 std::cerr << "ZeroMQ encountered an error receiving a message.\n";
+                 return errno;
+             }
diff --git a/nixpkgs/pkgs/tools/filesystems/jfsutils/ar-fix.patch b/nixpkgs/pkgs/tools/filesystems/jfsutils/ar-fix.patch
new file mode 100644
index 000000000000..697029cd5a8c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/jfsutils/ar-fix.patch
@@ -0,0 +1,10 @@
+--- jfsutils-1.1.15/configure.in.orig	2018-11-27 20:46:55.830242385 +0300
++++ jfsutils-1.1.15/configure.in	2018-11-27 20:47:00.596307630 +0300
+@@ -15,6 +15,7 @@
+ AC_PATH_PROG(LN, ln, ln)
+ AC_PROG_LN_S
+ AC_PROG_RANLIB
++AM_PROG_AR
+ 
+ dnl Checks for header files.
+ AC_HEADER_STDC
diff --git a/nixpkgs/pkgs/tools/filesystems/jfsutils/default.nix b/nixpkgs/pkgs/tools/filesystems/jfsutils/default.nix
new file mode 100644
index 000000000000..fadc639fbf63
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/jfsutils/default.nix
@@ -0,0 +1,33 @@
+{ lib, stdenv, fetchurl, fetchpatch, libuuid, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  name = "jfsutils-1.1.15";
+
+  src = fetchurl {
+    url = "http://jfs.sourceforge.net/project/pub/${name}.tar.gz";
+    sha256 = "0kbsy2sk1jv4m82rxyl25gwrlkzvl3hzdga9gshkxkhm83v1aji4";
+  };
+
+  patches = [
+    ./types.patch
+    ./hardening-format.patch
+    # required for cross-compilation
+    ./ar-fix.patch
+    # fix for glibc>=2.28
+    (fetchpatch {
+      name   = "add_sysmacros.patch";
+      url    = "https://sources.debian.org/data/main/j/jfsutils/1.1.15-4/debian/patches/add_sysmacros.patch";
+      sha256 = "1qcwvxs4d0d24w5x98z59arqfx2n7f0d9xaqhjcg6w8n34vkhnyc";
+    })
+  ];
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [ libuuid ];
+
+  meta = with lib; {
+    description = "IBM JFS utilities";
+    homepage = "http://jfs.sourceforge.net";
+    license = licenses.gpl3;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/jfsutils/hardening-format.patch b/nixpkgs/pkgs/tools/filesystems/jfsutils/hardening-format.patch
new file mode 100644
index 000000000000..dd2a93a81ec6
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/jfsutils/hardening-format.patch
@@ -0,0 +1,37 @@
+--- a/fscklog/fscklog.c	2016-01-29 04:59:54.102223291 +0000
++++ b/fscklog/fscklog.c	2016-01-29 05:00:10.707552565 +0000
+@@ -252,8 +252,8 @@
+ 
+ 	sprintf(debug_detail, " [%s:%d]\n", basename(file_name), line_number);
+ 
+-	printf(msg_string);
+-	printf(debug_detail);
++	printf("%s", msg_string);
++	printf("%s", debug_detail);
+ 
+ 	return 0;
+ }
+--- a/fscklog/display.c	2016-01-29 05:05:42.582133444 +0000
++++ b/fscklog/display.c	2016-01-29 05:05:47.541231780 +0000
+@@ -182,7 +182,7 @@
+ 				} else {
+ 					/* the record looks ok */
+ 					msg_txt = &log_entry[log_entry_pos];
+-					printf(msg_txt);
++					printf("%s", msg_txt);
+ 					/*
+ 					 * set up for the next record
+ 					 */
+--- a/logdump/helpers.c	2016-01-29 05:06:26.081996021 +0000
++++ b/logdump/helpers.c	2016-01-29 05:06:43.097333425 +0000
+@@ -95,8 +95,8 @@
+ 
+ 	sprintf(debug_detail, " [%s:%d]\n", file_name, line_number);
+ 
+-	printf(msg_string);
+-	printf(debug_detail);
++	printf("%s", msg_string);
++	printf("%s", debug_detail);
+ 
+ 	return 0;
+ }
diff --git a/nixpkgs/pkgs/tools/filesystems/jfsutils/types.patch b/nixpkgs/pkgs/tools/filesystems/jfsutils/types.patch
new file mode 100644
index 000000000000..a682f2695f9e
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/jfsutils/types.patch
@@ -0,0 +1,12 @@
+diff -ru -x '*~' jfsutils-1.1.15-orig/libfs/devices.h jfsutils-1.1.15/libfs/devices.h
+--- jfsutils-1.1.15-orig/libfs/devices.h	2005-11-22 21:43:55.000000000 +0100
++++ jfsutils-1.1.15/libfs/devices.h	2013-01-28 13:58:56.888630278 +0100
+@@ -18,6 +18,8 @@
+ #ifndef H_DEVICES
+ #define H_DEVICES
+ 
++#include <inttypes.h>
++
+ #define GET	0
+ #define PUT	1
+ #define VRFY	2
diff --git a/nixpkgs/pkgs/tools/filesystems/jmtpfs/default.nix b/nixpkgs/pkgs/tools/filesystems/jmtpfs/default.nix
new file mode 100644
index 000000000000..a9d3c40aae31
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/jmtpfs/default.nix
@@ -0,0 +1,25 @@
+{ lib, stdenv, fetchFromGitHub, pkg-config, file, fuse, libmtp }:
+
+let version = "0.5"; in
+stdenv.mkDerivation {
+  pname = "jmtpfs";
+  inherit version;
+
+  src = fetchFromGitHub {
+    sha256 = "1pm68agkhrwgrplrfrnbwdcvx5lrivdmqw8pb5gdmm3xppnryji1";
+    rev = "v${version}";
+    repo = "jmtpfs";
+    owner = "JasonFerrara";
+  };
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ file fuse libmtp ];
+
+  meta = with lib; {
+    description = "A FUSE filesystem for MTP devices like Android phones";
+    homepage = "https://github.com/JasonFerrara/jmtpfs";
+    license = licenses.gpl3;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.coconnor ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/lizardfs/default.nix b/nixpkgs/pkgs/tools/filesystems/lizardfs/default.nix
new file mode 100644
index 000000000000..766ac1f82ea6
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/lizardfs/default.nix
@@ -0,0 +1,49 @@
+{ lib, stdenv
+, fetchFromGitHub
+, fetchpatch
+, cmake
+, makeWrapper
+, python3
+, db
+, fuse
+, asciidoc
+, libxml2
+, libxslt
+, docbook_xml_dtd_412
+, docbook_xsl
+, boost
+, pkg-config
+, judy
+, pam
+, spdlog
+, fmt
+, systemdMinimal
+, zlib # optional
+}:
+
+stdenv.mkDerivation rec {
+  pname = "lizardfs";
+  version = "3.13.0-rc3";
+
+  src = fetchFromGitHub {
+    owner = pname;
+    repo = pname;
+    rev = version;
+    sha256 = "sha256-rgaFhJvmA1RVDL4+vQLMC0GrdlgUlvJeZ5/JJ67C20Q=";
+  };
+
+  nativeBuildInputs = [ cmake pkg-config makeWrapper ];
+
+  buildInputs = [
+    db fuse asciidoc libxml2 libxslt docbook_xml_dtd_412 docbook_xsl
+    zlib boost judy pam spdlog fmt python3 systemdMinimal
+  ];
+
+  meta = with lib; {
+    homepage = "https://lizardfs.com";
+    description = "A highly reliable, scalable and efficient distributed file system";
+    platforms = platforms.linux;
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ rushmorem shamilton ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/mergerfs/default.nix b/nixpkgs/pkgs/tools/filesystems/mergerfs/default.nix
new file mode 100644
index 000000000000..368f62f21969
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/mergerfs/default.nix
@@ -0,0 +1,41 @@
+{ lib, stdenv, fetchFromGitHub, automake, autoconf, pkg-config, gettext, libtool, pandoc, which, attr, libiconv }:
+
+stdenv.mkDerivation rec {
+  pname = "mergerfs";
+  version = "2.32.2";
+
+  src = fetchFromGitHub {
+    owner = "trapexit";
+    repo = pname;
+    rev = version;
+    sha256 = "sha256-ybDVBcPkjsW2OxNxUmn5hG/qLEjxF9vqR8pZdb9tIBs=";
+  };
+
+  nativeBuildInputs = [
+    automake autoconf pkg-config gettext libtool pandoc which
+  ];
+  prePatch = ''
+    sed -i -e '/chown/d' -e '/chmod/d' libfuse/Makefile
+  '';
+  buildInputs = [ attr libiconv ];
+
+  preConfigure = ''
+    echo "${version}" > VERSION
+  '';
+
+  makeFlags = [ "DESTDIR=${placeholder "out"}" "XATTR_AVAILABLE=1" "PREFIX=/" "SBINDIR=/bin" ];
+  enableParallelBuilding = true;
+
+  postFixup = ''
+    ln -srf $out/bin/mergerfs $out/bin/mount.fuse.mergerfs
+    ln -srf $out/bin/mergerfs $out/bin/mount.mergerfs
+  '';
+
+  meta = {
+    description = "A FUSE based union filesystem";
+    homepage = "https://github.com/trapexit/mergerfs";
+    license = lib.licenses.isc;
+    platforms = lib.platforms.linux;
+    maintainers = with lib.maintainers; [ jfrankenau makefu ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/mergerfs/tools.nix b/nixpkgs/pkgs/tools/filesystems/mergerfs/tools.nix
new file mode 100644
index 000000000000..e559fd9d4cd0
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/mergerfs/tools.nix
@@ -0,0 +1,36 @@
+{ lib, stdenv, fetchFromGitHub, coreutils, makeWrapper
+, rsync, python3, pythonPackages }:
+
+stdenv.mkDerivation rec {
+  pname = "mergerfs-tools";
+  version = "20190411";
+
+  src = fetchFromGitHub {
+    owner = "trapexit";
+    repo = pname;
+    rev = "6e41fc5848c7cc4408caea86f3991c8cc2ac85a1";
+    sha256 = "0izswg6bya13scvb37l3gkl7mvi8q7l11p4hp4phdlcwh9jvdzcj";
+  };
+
+  nativeBuildInputs = [ makeWrapper ];
+  buildInputs = [ python3 ];
+
+  makeFlags = [
+    "INSTALL=${coreutils}/bin/install"
+    "PREFIX=${placeholder "out"}"
+  ];
+
+  postInstall = with lib; ''
+    wrapProgram $out/bin/mergerfs.balance --prefix PATH : ${makeBinPath [ rsync ]}
+    wrapProgram $out/bin/mergerfs.dup --prefix PATH : ${makeBinPath [ rsync ]}
+    wrapProgram $out/bin/mergerfs.mktrash --prefix PATH : ${makeBinPath [ pythonPackages.xattr ]}
+  '';
+
+  meta = with lib; {
+    description = "Optional tools to help manage data in a mergerfs pool";
+    homepage = "https://github.com/trapexit/mergerfs-tools";
+    license = licenses.isc;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ jfrankenau ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/mhddfs/default.nix b/nixpkgs/pkgs/tools/filesystems/mhddfs/default.nix
new file mode 100644
index 000000000000..3a0d0ab2f65b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/mhddfs/default.nix
@@ -0,0 +1,35 @@
+{ lib, stdenv, fetchurl, fuse, pkg-config, attr, uthash }:
+
+stdenv.mkDerivation rec {
+  pname = "mhddfs";
+  version = "0.1.39";
+
+  src = fetchurl {
+    url = "http://mhddfs.uvw.ru/downloads/mhddfs_${version}.tar.gz";
+    sha256 = "14ggmh91vv69fp2qpz0nxp0hprlw2wsijss2k2485hb0ci4cabvh";
+  };
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ fuse attr uthash ];
+
+  patches = [
+    ./fix-format-security-error.patch
+  ];
+
+  postPatch = ''
+    substituteInPlace src/main.c --replace "attr/xattr.h" "sys/xattr.h"
+    substituteInPlace src/tools.c --replace "attr/xattr.h" "sys/xattr.h"
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp mhddfs $out/bin/
+  '';
+
+  meta = {
+    homepage = "http://mhddfs.uvw.ru/";
+    description = "Combines a several mount points into the single one";
+    license = lib.licenses.gpl3;
+    maintainers = [ lib.maintainers.makefu ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/mhddfs/fix-format-security-error.patch b/nixpkgs/pkgs/tools/filesystems/mhddfs/fix-format-security-error.patch
new file mode 100644
index 000000000000..35e58cf0ce9e
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/mhddfs/fix-format-security-error.patch
@@ -0,0 +1,12 @@
+--- mhddfs-0.1.39/src/usage.c.old	2017-02-28 15:00:25.435438622 +0100
++++ mhddfs-0.1.39/src/usage.c	2017-02-28 15:00:33.847454958 +0100
+@@ -43,7 +43,7 @@
+ 		"\n"
+ 		" see fusermount(1) for information about other options\n"
+ 		"";
+-	fprintf(to, usage);
++	fputs(usage, to);
+ 	if (to==stdout) exit(0);
+ 	exit(-1);
+ }
+
diff --git a/nixpkgs/pkgs/tools/filesystems/mkspiffs/default.nix b/nixpkgs/pkgs/tools/filesystems/mkspiffs/default.nix
new file mode 100644
index 000000000000..30312ec7dc7b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/mkspiffs/default.nix
@@ -0,0 +1,32 @@
+{ lib, stdenv, fetchFromGitHub, git }:
+
+# Changing the variables CPPFLAGS and BUILD_CONFIG_NAME can be done by
+# overriding the same-named attributes. See ./presets.nix for examples.
+
+stdenv.mkDerivation rec {
+  pname = "mkspiffs";
+  version = "0.2.3";
+
+  src = fetchFromGitHub {
+    owner = "igrr";
+    repo = "mkspiffs";
+    rev = version;
+    fetchSubmodules = true;
+    sha256 = "1fgw1jqdlp83gv56mgnxpakky0q6i6f922niis4awvxjind8pbm1";
+  };
+
+  nativeBuildInputs = [ git ];
+  buildFlags = [ "dist" ];
+  installPhase = ''
+    mkdir -p $out/bin
+    cp mkspiffs $out/bin
+  '';
+
+  meta = with lib; {
+    description = "Tool to build and unpack SPIFFS images";
+    license = licenses.mit;
+    homepage = "https://github.com/igrr/mkspiffs";
+    maintainers = with maintainers; [ haslersn ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/mkspiffs/presets.nix b/nixpkgs/pkgs/tools/filesystems/mkspiffs/presets.nix
new file mode 100644
index 000000000000..c0b74d9cf1b7
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/mkspiffs/presets.nix
@@ -0,0 +1,20 @@
+{ lib, mkspiffs }:
+
+# We provide the same presets as the upstream
+
+lib.mapAttrs (
+  name: { CPPFLAGS }:
+  mkspiffs.overrideAttrs (drv: {
+    inherit CPPFLAGS;
+    BUILD_CONFIG_NAME = "-${name}";
+  })
+) {
+  arduino-esp8266.CPPFLAGS = [
+    "-DSPIFFS_USE_MAGIC_LENGTH=0"
+    "-DSPIFFS_ALIGNED_OBJECT_INDEX_TABLES=1"
+  ];
+
+  arduino-esp32.CPPFLAGS = [ "-DSPIFFS_OBJ_META_LEN=4" ];
+
+  esp-idf.CPPFLAGS = [ "-DSPIFFS_OBJ_META_LEN=4" ];
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/moosefs/default.nix b/nixpkgs/pkgs/tools/filesystems/moosefs/default.nix
new file mode 100644
index 000000000000..e38b040ec0d0
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/moosefs/default.nix
@@ -0,0 +1,38 @@
+{ lib, stdenv
+, fetchFromGitHub
+, makeWrapper
+, python
+, fuse
+, pkg-config
+, libpcap
+, zlib
+}:
+
+stdenv.mkDerivation rec {
+  pname = "moosefs";
+  version = "3.0.115";
+
+  src = fetchFromGitHub {
+    owner = pname;
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "0dap9dqwwx8adma6arxg015riqc86cmjv2m44hk0kz7s24h79ipq";
+  };
+
+  nativeBuildInputs = [ pkg-config makeWrapper ];
+
+  buildInputs =
+    [ fuse libpcap zlib python ];
+
+  postInstall = ''
+    substituteInPlace $out/sbin/mfscgiserv --replace "datapath=\"$out" "datapath=\""
+  '';
+
+  meta = with lib; {
+    homepage = "https://moosefs.com";
+    description = "Open Source, Petabyte, Fault-Tolerant, Highly Performing, Scalable Network Distributed File System";
+    platforms = platforms.linux;
+    license = licenses.gpl2;
+    maintainers = [ maintainers.mfossen ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/mp3fs/default.nix b/nixpkgs/pkgs/tools/filesystems/mp3fs/default.nix
new file mode 100644
index 000000000000..8b241e9026e2
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/mp3fs/default.nix
@@ -0,0 +1,32 @@
+{ lib, stdenv, fetchurl, flac, fuse, lame, libid3tag, pkg-config }:
+
+stdenv.mkDerivation rec {
+  pname = "mp3fs";
+  version = "0.91";
+
+  src = fetchurl {
+    url = "https://github.com/khenriks/mp3fs/releases/download/v${version}/${pname}-${version}.tar.gz";
+    sha256 = "14ngiqg24p3a0s6hp33zjl4i46d8qn4v9id36psycq3n3csmwyx4";
+  };
+
+  patches = [ ./fix-statfs-operation.patch ];
+
+  buildInputs = [ flac fuse lame libid3tag ];
+  nativeBuildInputs = [ pkg-config ];
+
+  enableParallelBuilding = true;
+
+  meta = with lib; {
+    description = "FUSE file system that transparently transcodes to MP3";
+    longDescription = ''
+      A read-only FUSE filesystem which transcodes between audio formats
+      (currently only FLAC to MP3) on the fly when files are opened and read.
+      It can let you use a FLAC collection with software and/or hardware
+      which only understands the MP3 format, or transcode files through
+      simple drag-and-drop in a file browser.
+    '';
+    homepage = "https://khenriks.github.io/mp3fs/";
+    license = licenses.gpl3Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/mp3fs/fix-statfs-operation.patch b/nixpkgs/pkgs/tools/filesystems/mp3fs/fix-statfs-operation.patch
new file mode 100644
index 000000000000..9b3094e60053
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/mp3fs/fix-statfs-operation.patch
@@ -0,0 +1,39 @@
+From fea072084ff9d7c4d2c688059a2462bb0e59a2ec Mon Sep 17 00:00:00 2001
+From: K Henriksson <kthenriksson@gmail.com>
+Date: Wed, 27 Aug 2014 21:55:18 -0700
+Subject: [PATCH] Fix statfs operation
+
+The statfs implementation does not properly translate names back to the
+original, since the major encoding rewrite. This corrects that, and
+should fix issue #27.
+---
+ src/fuseops.c | 15 +++++++++++++--
+ 1 file changed, 13 insertions(+), 2 deletions(-)
+
+diff --git a/src/fuseops.c b/src/fuseops.c
+index e7b4e7e..c333cbd 100644
+--- a/src/fuseops.c
++++ b/src/fuseops.c
+@@ -337,9 +337,20 @@ static int mp3fs_statfs(const char *path, struct statvfs *stbuf) {
+     if (!origpath) {
+         goto translate_fail;
+     }
+-    
++
++    /* pass-through for regular files */
++    if (statvfs(origpath, stbuf) == 0) {
++        goto passthrough;
++    } else {
++        /* Not really an error. */
++        errno = 0;
++    }
++
++    find_original(origpath);
++
+     statvfs(origpath, stbuf);
+-    
++
++passthrough:
+     free(origpath);
+ translate_fail:
+     return -errno;
diff --git a/nixpkgs/pkgs/tools/filesystems/mtdutils/default.nix b/nixpkgs/pkgs/tools/filesystems/mtdutils/default.nix
new file mode 100644
index 000000000000..d753e7c52042
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/mtdutils/default.nix
@@ -0,0 +1,30 @@
+{ lib, stdenv, fetchurl, autoreconfHook, pkg-config, cmocka, acl, libuuid, lzo, zlib, zstd }:
+
+stdenv.mkDerivation rec {
+  pname = "mtd-utils";
+  version = "2.1.1";
+
+  src = fetchurl {
+    url = "ftp://ftp.infradead.org/pub/${pname}/${pname}-${version}.tar.bz2";
+    sha256 = "1lijl89l7hljx8xx70vrz9srd3h41v5gh4b0lvqnlv831yvyh5cd";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkg-config ] ++ lib.optional doCheck cmocka;
+  buildInputs = [ acl libuuid lzo zlib zstd ];
+
+  configureFlags = [
+    (lib.enableFeature doCheck "unit-tests")
+    (lib.enableFeature doCheck "tests")
+  ];
+  enableParallelBuilding = true;
+
+  doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
+
+  meta = {
+    description = "Tools for MTD filesystems";
+    license = lib.licenses.gpl2Plus;
+    homepage = "http://www.linux-mtd.infradead.org/";
+    maintainers = with lib.maintainers; [ viric ];
+    platforms = with lib.platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/mtools/UNUSED-darwin.patch b/nixpkgs/pkgs/tools/filesystems/mtools/UNUSED-darwin.patch
new file mode 100644
index 000000000000..46b790afd30a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/mtools/UNUSED-darwin.patch
@@ -0,0 +1,11 @@
+--- mtools/sysincludes.h.orig	2017-04-01 20:59:46.083196540 +0100
++++ mtools/sysincludes.h	2017-04-01 20:59:12.855030456 +0100
+@@ -103,7 +103,7 @@
+ # define PACKED __attribute__ ((packed))
+ # if __GNUC__ == 2 && __GNUC_MINOR__ > 6 || __GNUC__ >= 3
+ /* gcc 2.6.3 doesn't have "unused" */		/* mool */
+-#  define UNUSED(x) x __attribute__ ((unused));x
++#  define UNUSED(x) x
+ #  define UNUSEDP __attribute__ ((unused))
+ # else
+ #  define UNUSED(x) x
diff --git a/nixpkgs/pkgs/tools/filesystems/mtools/default.nix b/nixpkgs/pkgs/tools/filesystems/mtools/default.nix
new file mode 100644
index 000000000000..4316e0ee4268
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/mtools/default.nix
@@ -0,0 +1,25 @@
+{ lib, stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  pname = "mtools";
+  version = "4.0.26";
+
+  src = fetchurl {
+    url = "mirror://gnu/mtools/${pname}-${version}.tar.bz2";
+    sha256 = "06pabnjc4r2vv3dzfm6q97g6jbp2k5bhmcdwv2cf25ka8y5ir7sk";
+  };
+
+  patches = lib.optional stdenv.isDarwin ./UNUSED-darwin.patch;
+
+  # fails to find X on darwin
+  configureFlags = lib.optional stdenv.isDarwin "--without-x";
+
+  doCheck = true;
+
+  meta = with lib; {
+    homepage = "https://www.gnu.org/software/mtools/";
+    description = "Utilities to access MS-DOS disks";
+    platforms = platforms.unix;
+    license = licenses.gpl3;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/mtpfs/default.nix b/nixpkgs/pkgs/tools/filesystems/mtpfs/default.nix
new file mode 100644
index 000000000000..e0b1cffe4dd7
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/mtpfs/default.nix
@@ -0,0 +1,28 @@
+{ lib, stdenv, fetchurl, pkg-config, fuse, libmtp, glib, libmad, libid3tag }:
+
+stdenv.mkDerivation rec {
+  name = "mtpfs-1.1";
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ fuse libmtp glib libid3tag libmad ];
+
+  # adding LIBS is a hack, duno why it does not find libid3tag.so by adding buildInputs
+  preConfigure = ''
+    export MAD_CFLAGS=${libmad}/include
+    export MAD_LIBS=${libmad}/lib/libmad.so
+    export LIBS=${libid3tag}/lib/libid3tag.so
+  '';
+
+  src = fetchurl {
+    url = "https://www.adebenham.com/files/mtp/${name}.tar.gz";
+    sha256 = "07acrqb17kpif2xcsqfqh5j4axvsa4rnh6xwnpqab5b9w5ykbbqv";
+  };
+
+  meta = with lib; {
+    homepage = "https://github.com/cjd/mtpfs";
+    description = "FUSE Filesystem providing access to MTP devices";
+    platforms = platforms.all;
+    license = licenses.gpl3;
+    maintainers = [ maintainers.qknight ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/netatalk/default.nix b/nixpkgs/pkgs/tools/filesystems/netatalk/default.nix
new file mode 100644
index 000000000000..486963f44b9a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/netatalk/default.nix
@@ -0,0 +1,61 @@
+{ fetchurl, lib, stdenv, autoreconfHook, pkg-config, perl, python
+, db, libgcrypt, avahi, libiconv, pam, openssl, acl
+, ed, libtirpc, libevent
+}:
+
+stdenv.mkDerivation rec {
+  name = "netatalk-3.1.12";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/netatalk/netatalk/${name}.tar.bz2";
+    sha256 = "1ld5mnz88ixic21m6f0xcgf8v6qm08j6xabh1dzfj6x47lxghq0m";
+  };
+
+  patches = [
+    ./no-suid.patch
+    ./omitLocalstatedirCreation.patch
+  ];
+
+  nativeBuildInputs = [ autoreconfHook pkg-config perl python python.pkgs.wrapPython ];
+
+  buildInputs = [ db libgcrypt avahi libiconv pam openssl acl libevent ];
+
+  configureFlags = [
+    "--with-bdb=${db.dev}"
+    "--with-ssl-dir=${openssl.dev}"
+    "--with-lockfile=/run/lock/netatalk"
+    "--with-libevent=${libevent.dev}"
+    "--localstatedir=/var/lib"
+  ];
+
+  # Expose librpcsvc to the linker for afpd
+  # Fixes errors that showed up when closure-size was merged:
+  # afpd-nfsquota.o: In function `callaurpc':
+  # netatalk-3.1.7/etc/afpd/nfsquota.c:78: undefined reference to `xdr_getquota_args'
+  # netatalk-3.1.7/etc/afpd/nfsquota.c:78: undefined reference to `xdr_getquota_rslt'
+  postConfigure = ''
+    ${ed}/bin/ed -v etc/afpd/Makefile << EOF
+    /^afpd_LDADD
+    /am__append_2
+    a
+      ${libtirpc}/lib/libtirpc.so \\
+    .
+    w
+    EOF
+  '';
+
+  postInstall = ''
+    buildPythonPath ${python.pkgs.dbus-python}
+    patchPythonScript $out/bin/afpstats
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "Apple Filing Protocol Server";
+    homepage = "http://netatalk.sourceforge.net/";
+    license = lib.licenses.gpl3;
+    platforms = lib.platforms.linux;
+    maintainers = with lib.maintainers; [ jcumming ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/netatalk/no-suid.patch b/nixpkgs/pkgs/tools/filesystems/netatalk/no-suid.patch
new file mode 100644
index 000000000000..194c1f5fac9f
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/netatalk/no-suid.patch
@@ -0,0 +1,11 @@
+diff --git a/bin/afppasswd/Makefile.am b/bin/afppasswd/Makefile.am
+index 578eac1..d17aa22 100644
+--- a/bin/afppasswd/Makefile.am
++++ b/bin/afppasswd/Makefile.am
+@@ -16,5 +16,5 @@ AM_CFLAGS = @SSL_CFLAGS@ -I$(top_srcdir)/sys \
+ 
+ install-exec-hook:
+ if HAVE_OPENSSL
+-	chmod u+s $(DESTDIR)$(bindir)/afppasswd
++#	chmod u+s $(DESTDIR)$(bindir)/afppasswd
+ endif
diff --git a/nixpkgs/pkgs/tools/filesystems/netatalk/omitLocalstatedirCreation.patch b/nixpkgs/pkgs/tools/filesystems/netatalk/omitLocalstatedirCreation.patch
new file mode 100644
index 000000000000..01c4ee9ba478
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/netatalk/omitLocalstatedirCreation.patch
@@ -0,0 +1,19 @@
+diff --git a/config/Makefile.am b/config/Makefile.am
+index c98a2ab..58b7f0a 100644
+--- a/config/Makefile.am
++++ b/config/Makefile.am
+@@ -36,10 +36,10 @@ endif
+ #
+ 
+ install-data-local: install-config-files
+-	mkdir -pm 0755 $(DESTDIR)$(localstatedir)/netatalk/
+-	mkdir -pm 0755 $(DESTDIR)$(localstatedir)/netatalk/CNID/
+-	$(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(localstatedir)/netatalk/
+-	$(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(localstatedir)/netatalk/CNID/
++#	mkdir -pm 0755 $(DESTDIR)$(localstatedir)/netatalk/
++#	mkdir -pm 0755 $(DESTDIR)$(localstatedir)/netatalk/CNID/
++#	$(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(localstatedir)/netatalk/
++#	$(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(localstatedir)/netatalk/CNID/
+ 
+ uninstall-local:
+ 	@for f in $(CONFFILES) $(GENFILES); do \
diff --git a/nixpkgs/pkgs/tools/filesystems/nilfs-utils/default.nix b/nixpkgs/pkgs/tools/filesystems/nilfs-utils/default.nix
new file mode 100644
index 000000000000..0639c6a6f21b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nilfs-utils/default.nix
@@ -0,0 +1,63 @@
+{ lib, stdenv, fetchurl, fetchpatch, libuuid, libselinux }:
+let
+  sourceInfo = rec {
+    version = "2.2.7";
+    url = "http://nilfs.sourceforge.net/download/nilfs-utils-${version}.tar.bz2";
+    sha256 = "01f09bvjk2crx65pxmxiw362wkkl3v2v144dfn3i7bk5gz253xic";
+    baseName = "nilfs-utils";
+    name = "${baseName}-${version}";
+  };
+in
+stdenv.mkDerivation {
+  src = fetchurl {
+    url = sourceInfo.url;
+    sha256 = sourceInfo.sha256;
+  };
+
+  inherit (sourceInfo) name version;
+  buildInputs = [libuuid libselinux];
+
+  preConfigure = ''
+    sed -e '/sysconfdir=\/etc/d; ' -i configure
+    sed -e "s@sbindir=/sbin@sbindir=$out/sbin@" -i configure
+    sed -e 's@/sbin/@'"$out"'/sbin/@' -i ./lib/cleaner*.c
+  '';
+
+  patches = [
+    # Fix w/musl
+    (fetchpatch {
+      url = "https://github.com/nilfs-dev/nilfs-utils/commit/115fe4b976858c487cf83065f513d8626089579a.patch";
+      sha256 = "0h89jz9l5d4rqj647ljbnv451l4ncqpsvzj0v70mn5391hfwsjlv";
+    })
+    (fetchpatch {
+      url =  "https://github.com/nilfs-dev/nilfs-utils/commit/51b32c614be9e98c32de7f531ee600ca0740946f.patch";
+      sha256 = "1ycq83c6jjy74aif47v075k5y2szzwhq6mbcrpd1z4b4i1x6yhpn";
+    })
+  ];
+
+  configureFlags = [
+    "--with-libmount"
+  ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+    # AC_FUNC_MALLOC is broken on cross builds.
+    "ac_cv_func_malloc_0_nonnull=yes"
+    "ac_cv_func_realloc_0_nonnull=yes"
+  ];
+
+  # FIXME: https://github.com/NixOS/patchelf/pull/98 is in, but stdenv
+  # still doesn't use it
+  #
+  # To make sure patchelf doesn't mistakenly keep the reference via
+  # build directory
+  postInstall = ''
+    find . -name .libs | xargs rm -rf
+  '';
+
+  meta = with lib; {
+    description = "NILFS utilities";
+    maintainers = [ maintainers.raskin ];
+    platforms = platforms.linux;
+    license =  with licenses; [ gpl2 lgpl21 ];
+    downloadPage = "http://nilfs.sourceforge.net/en/download.html";
+    updateWalker = true;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/blivet.nix b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/blivet.nix
new file mode 100644
index 000000000000..94ed258d3322
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/blivet.nix
@@ -0,0 +1,50 @@
+# FIXME: Unify with pkgs/development/python-modules/blivet/default.nix.
+
+{ lib, fetchurl, buildPythonApplication, pykickstart, pyparted, pyblock
+, libselinux, cryptsetup, multipath_tools, lsof, util-linux
+, useNixUdev ? true, systemd ? null
+# useNixUdev is here for bw compatibility
+}:
+
+assert useNixUdev -> systemd != null;
+
+buildPythonApplication rec {
+  pname = "blivet";
+  version = "0.17-1";
+
+  src = fetchurl {
+    url = "https://git.fedorahosted.org/cgit/blivet.git/snapshot/"
+        + "${pname}-${version}.tar.bz2";
+    sha256 = "1k3mws2q0ryb7422mml6idmaasz2i2v6ngyvg6d976dx090qnmci";
+  };
+
+  patches = [ ./blivet.patch ];
+
+  postPatch = ''
+    sed -i -e 's|"multipath"|"${multipath_tools}/sbin/multipath"|' \
+      blivet/devicelibs/mpath.py blivet/devices.py
+    sed -i -e '/"wipefs"/ {
+      s|wipefs|${util-linux.bin}/sbin/wipefs|
+      s/-f/--force/
+    }' blivet/formats/__init__.py
+    sed -i -e 's|"lsof"|"${lsof}/bin/lsof"|' blivet/formats/fs.py
+    sed -i -r -e 's|"(u?mount)"|"${util-linux.bin}/bin/\1"|' blivet/util.py
+    sed -i -e '/find_library/,/find_library/ {
+      c libudev = "${lib.getLib systemd}/lib/libudev.so.1"
+    }' blivet/pyudev.py
+  '';
+
+  propagatedBuildInputs = [
+    pykickstart pyparted pyblock libselinux cryptsetup
+  ] ++ lib.optional useNixUdev systemd;
+
+  # tests are currently _heavily_ broken upstream
+  doCheck = false;
+
+  meta = with lib; {
+    homepage = "https://fedoraproject.org/wiki/Blivet";
+    description = "Module for management of a system's storage configuration";
+    license = with licenses; [ gpl2Plus lgpl21Plus ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/blivet.patch b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/blivet.patch
new file mode 100644
index 000000000000..d53231a84fd6
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/blivet.patch
@@ -0,0 +1,51 @@
+diff --git a/blivet/pyudev.py b/blivet/pyudev.py
+index 705b93d..7268d71 100644
+--- a/blivet/pyudev.py
++++ b/blivet/pyudev.py
+@@ -7,9 +7,9 @@ from ctypes import *
+ 
+ 
+ # XXX this one may need some tweaking...
+-def find_library(name, somajor=0):
++def find_library(name):
+     env = os.environ.get("LD_LIBRARY_PATH")
+-    common = ["/lib64", "/lib"]
++    common = ["/lib64", "/lib", "/lib/x86_64-linux-gnu", "/lib/i686-linux-gnu"]
+ 
+     if env:
+         libdirs = env.split(":") + common
+@@ -19,7 +19,7 @@ def find_library(name, somajor=0):
+     libdirs = filter(os.path.isdir, libdirs)
+ 
+     for dir in libdirs:
+-        files = fnmatch.filter(os.listdir(dir), "lib%s.so.%d" % (name, somajor))
++        files = fnmatch.filter(os.listdir(dir), "lib%s.so.*" % name)
+         files = [os.path.join(dir, file) for file in files]
+ 
+         if files:
+@@ -32,11 +32,10 @@ def find_library(name, somajor=0):
+ 
+ # find the udev library
+ name = "udev"
+-somajor = 1
+-libudev = find_library(name=name, somajor=somajor)
++libudev = find_library(name)
+ 
+ if not libudev or not os.path.exists(libudev):
+-    raise ImportError, "No library named %s.%d" % (name, somajor)
++    raise ImportError, "No library named lib%s.so" % name
+ 
+ # load the udev library
+ libudev = CDLL(libudev)
+diff --git a/blivet/deviceaction.py b/blivet/deviceaction.py
+index 705b93d..60f8f32 100644
+--- a/blivet/deviceaction.py
++++ b/blivet/deviceaction.py
+@@ -467,6 +467,7 @@ def execute(self):
+ 
+                 self.device.disk.format.commitToDisk()
+ 
++            self.device.setup()
+             self.device.format.create(device=self.device.path,
+                                       options=self.device.formatArgs)
+ 
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/cryptsetup.nix b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/cryptsetup.nix
new file mode 100644
index 000000000000..6e372b75a7d7
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/cryptsetup.nix
@@ -0,0 +1,38 @@
+{ lib, stdenv, fetchurl, fetchpatch, lvm2, libgcrypt, libuuid, pkg-config, popt
+, enablePython ? true, python ? null
+}:
+
+assert enablePython -> python != null;
+
+stdenv.mkDerivation rec {
+  name = "cryptsetup-1.6.3";
+
+  src = fetchurl {
+    url = "http://cryptsetup.googlecode.com/files/${name}.tar.bz2";
+    sha256 = "1n1qk5chyjspbiianrdb55fhb4wl0vfyqz2br05vfb24v4qlgbx2";
+  };
+
+  patches = [
+    # Fix build with glibc >= 2.28
+    # https://github.com/NixOS/nixpkgs/issues/86403
+    (fetchpatch {
+      url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-fs/cryptsetup/files/cryptsetup-1.7.1-sysmacros.patch?id=d72316f97ebcc7fe622b21574442a9ac59b9115f";
+      sha256 = "0xbhazgl44bimqhcrhajk016w9wi7bkrgwyfq13xmrvyrllqvgdx";
+    })
+  ];
+
+  configureFlags = [ "--enable-cryptsetup-reencrypt" ]
+                ++ lib.optional enablePython "--enable-python";
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ lvm2 libgcrypt libuuid popt ]
+             ++ lib.optional enablePython python;
+
+  meta = with lib; {
+    homepage = "http://code.google.com/p/cryptsetup/";
+    description = "LUKS for dm-crypt";
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ ];
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/default.nix b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/default.nix
new file mode 100644
index 000000000000..7b773a61a5f2
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/default.nix
@@ -0,0 +1,77 @@
+{ lib, stdenv, fetchurl, python, buildPythonApplication
+, libselinux
+# Propagated to blivet
+, useNixUdev ? true
+# Needed by NixOps
+, udevSoMajor ? null
+# Propagated dependencies
+, pkgs, urlgrabber
+}:
+
+let
+  blivet = import ./blivet.nix {
+    inherit lib fetchurl buildPythonApplication;
+    inherit pykickstart pyparted pyblock cryptsetup libselinux multipath_tools;
+    inherit useNixUdev;
+    inherit (pkgs) lsof util-linux systemd;
+  };
+
+  cryptsetup = import ./cryptsetup.nix {
+    inherit lib stdenv fetchurl python;
+    inherit (pkgs) fetchpatch pkg-config libgcrypt libuuid popt lvm2;
+  };
+
+  dmraid = import ./dmraid.nix {
+    inherit lib stdenv fetchurl lvm2;
+  };
+
+  lvm2 = import ./lvm2.nix {
+    inherit lib stdenv fetchurl;
+    inherit (pkgs) fetchpatch pkg-config util-linux systemd coreutils;
+  };
+
+  multipath_tools = import ./multipath-tools.nix {
+    inherit lib stdenv fetchurl lvm2;
+    inherit (pkgs) fetchpatch readline systemd libaio gzip;
+  };
+
+  parted = import ./parted.nix {
+    inherit lib stdenv fetchurl;
+    inherit (pkgs) fetchpatch util-linux readline libuuid gettext check lvm2;
+  };
+
+  pyblock = import ./pyblock.nix {
+    inherit lib stdenv fetchurl python lvm2 dmraid;
+  };
+
+  pykickstart = import ./pykickstart.nix {
+    inherit lib fetchurl python buildPythonApplication urlgrabber;
+  };
+
+  pyparted = import ./pyparted.nix {
+    inherit lib stdenv fetchurl python buildPythonApplication parted;
+    inherit (pkgs) pkg-config e2fsprogs;
+  };
+
+in buildPythonApplication rec {
+  pname = "nixpart";
+  version = "0.4.1";
+  disabled = python.isPy3k;
+
+  src = fetchurl {
+    url = "https://github.com/NixOS/nixpart/archive/v${version}.tar.gz";
+    sha256 = "0avwd8p47xy9cydlbjxk8pj8q75zyl68gw2w6fnkk78dcb1a3swp";
+  };
+
+  propagatedBuildInputs = [ blivet ];
+
+  doCheck = false;
+
+  meta = with lib; {
+    description = "NixOS storage manager/partitioner";
+    homepage = "https://github.com/NixOS/nixpart";
+    license = licenses.gpl2Plus;
+    maintainers = [ maintainers.aszlig ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/dmraid.nix b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/dmraid.nix
new file mode 100644
index 000000000000..c5d8eebc47ca
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/dmraid.nix
@@ -0,0 +1,26 @@
+{ lib, stdenv, fetchurl, lvm2 }:
+
+stdenv.mkDerivation rec {
+  name = "dmraid-1.0.0.rc15";
+
+  src = fetchurl {
+    url = "https://people.redhat.com/~heinzm/sw/dmraid/src/old/${name}.tar.bz2";
+    sha256 = "01bcaq0sc329ghgj7f182xws7jgjpdc41bvris8fsiprnxc7511h";
+  };
+
+  preConfigure = "cd */";
+
+  buildInputs = [ lvm2 ];
+
+  meta = with lib; {
+    description = "Old-style RAID configuration utility";
+    longDescription = ''
+      Old RAID configuration utility (still under development, though).
+      It is fully compatible with modern kernels and mdadm recognizes
+      its volumes. May be needed for rescuing an older system or nuking
+      the metadata when reformatting.
+    '';
+    maintainers = [ maintainers.raskin ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/lvm2.nix b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/lvm2.nix
new file mode 100644
index 000000000000..ca349c7f42e4
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/lvm2.nix
@@ -0,0 +1,76 @@
+{ lib, stdenv, fetchurl, fetchpatch, pkg-config, systemd, util-linux, coreutils }:
+
+let
+  v = "2.02.106";
+in
+
+stdenv.mkDerivation {
+  name = "lvm2-${v}";
+
+  src = fetchurl {
+    url = "ftp://sources.redhat.com/pub/lvm2/releases/LVM2.${v}.tgz";
+    sha256 = "0nr833bl0q4zq52drjxmmpf7bs6kqxwa5kahwwxm9411khkxz0vc";
+  };
+
+  patches = [
+    # Fix build with glibc >= 2.28
+    # https://github.com/NixOS/nixpkgs/issues/86403
+    (fetchpatch {
+      url = "https://github.com/lvmteam/lvm2/commit/92d5a8441007f578e000b492cecf67d6b8a87405.patch";
+      sha256 = "1yqd6jng0b370k53vks1shg57yhfyribhpmv19km5zsjqf0qqx2d";
+      excludes = [
+        "libdm/libdm-stats.c"
+      ];
+    })
+  ];
+
+  configureFlags = [
+    "--disable-readline"
+    "--enable-udev_rules"
+    "--enable-udev_sync"
+    "--enable-pkg-config"
+    "--enable-applib"
+  ];
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ systemd ];
+
+  preConfigure =
+    ''
+      substituteInPlace scripts/lvmdump.sh \
+        --replace /usr/bin/tr ${coreutils}/bin/tr
+      substituteInPlace scripts/lvm2_activation_generator_systemd_red_hat.c \
+        --replace /usr/sbin/lvm $out/sbin/lvm \
+        --replace /usr/bin/udevadm ${systemd}/bin/udevadm
+
+      sed -i /DEFAULT_SYS_DIR/d Makefile.in
+      sed -i /DEFAULT_PROFILE_DIR/d conf/Makefile.in
+    '';
+
+  enableParallelBuilding = true;
+
+  #patches = [ ./purity.patch ];
+
+  # To prevent make install from failing.
+  installFlags = [ "OWNER=" "GROUP=" "confdir=${placeholder "out"}/etc" ];
+
+  # Install systemd stuff.
+  #installTargets = "install install_systemd_generators install_systemd_units install_tmpfiles_configuration";
+
+  postInstall =
+    ''
+      substituteInPlace $out/lib/udev/rules.d/13-dm-disk.rules \
+        --replace $out/sbin/blkid ${util-linux.bin}/sbin/blkid
+
+      # Systemd stuff
+      mkdir -p $out/etc/systemd/system $out/lib/systemd/system-generators
+      cp scripts/blk_availability_systemd_red_hat.service $out/etc/systemd/system
+      cp scripts/lvm2_activation_generator_systemd_red_hat $out/lib/systemd/system-generators
+    '';
+
+  meta = with lib; {
+    homepage = "http://sourceware.org/lvm2/";
+    description = "Tools to support Logical Volume Management (LVM) on Linux";
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/multipath-tools.nix b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/multipath-tools.nix
new file mode 100644
index 000000000000..976a3ce2567a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/multipath-tools.nix
@@ -0,0 +1,53 @@
+# FIXME: unify with pkgs/os-specific/linux/multipath-tools/default.nix.
+
+{ lib, stdenv, fetchurl, fetchpatch, lvm2, libaio, gzip, readline, systemd }:
+
+stdenv.mkDerivation rec {
+  name = "multipath-tools-0.4.9";
+
+  src = fetchurl {
+    url = "http://christophe.varoqui.free.fr/multipath-tools/${name}.tar.bz2";
+    sha256 = "04n7kazp1zrlqfza32phmqla0xkcq4zwn176qff5ida4a60whi4d";
+  };
+
+  patches = [
+    # Fix build with glibc >= 2.28
+    # https://github.com/NixOS/nixpkgs/issues/86403
+    (fetchpatch {
+      url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-fs/multipath-tools/files/multipath-tools-0.6.4-sysmacros.patch?id=eb22b954c177b5c1e2b6ed5c7cdd02f40f40d757";
+      sha256 = "1an0cgmz7g03c4qjimhpm9fcf2iswws18lwqxi688k87qm3xb5qd";
+      excludes = [
+        "libmultipath/util.c"
+      ];
+    })
+  ];
+
+  sourceRoot = ".";
+
+  buildInputs = [ lvm2 libaio readline gzip ];
+
+  preBuild =
+    ''
+      makeFlagsArray=(GZIP="-9" prefix=$out mandir=$out/share/man/man8 man5dir=$out/share/man/man5 LIB=lib)
+
+      substituteInPlace multipath/Makefile --replace /etc $out/etc
+      substituteInPlace kpartx/Makefile --replace /etc $out/etc
+
+      substituteInPlace kpartx/kpartx.rules --replace /sbin/kpartx $out/sbin/kpartx
+      substituteInPlace kpartx/kpartx_id --replace /sbin/dmsetup ${lvm2}/sbin/dmsetup
+
+      substituteInPlace libmultipath/defaults.h --replace /lib/udev/scsi_id ${lib.getLib systemd}/lib/udev/scsi_id
+      substituteInPlace libmultipath/hwtable.c --replace /lib/udev/scsi_id ${lib.getLib systemd}/lib/udev/scsi_id
+
+      sed -i -re '
+         s,^( *#define +DEFAULT_MULTIPATHDIR\>).*,\1 "'"$out/lib/multipath"'",
+      ' libmultipath/defaults.h
+
+    '';
+
+  meta = with lib; {
+    description = "Tools for the Linux multipathing driver";
+    homepage = "http://christophe.varoqui.free.fr/";
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/parted.nix b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/parted.nix
new file mode 100644
index 000000000000..2891f990afb0
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/parted.nix
@@ -0,0 +1,61 @@
+{ lib,stdenv, fetchurl, fetchpatch, lvm2, libuuid, gettext, readline
+, util-linux, check
+, enableStatic ? stdenv.hostPlatform.isStatic
+}:
+
+stdenv.mkDerivation rec {
+  name = "parted-3.1";
+
+  src = fetchurl {
+    url = "mirror://gnu/parted/${name}.tar.xz";
+    sha256 = "05fa4m1bky9d13hqv91jlnngzlyn7y4rnnyq6d86w0dg3vww372y";
+  };
+
+  patches = [
+    # Fix build with glibc >= 2.28
+    # https://github.com/NixOS/nixpkgs/issues/86403
+    (fetchpatch {
+      url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-block/parted/files/parted-3.2-sysmacros.patch?id=8e2414f551c14166f259f9a25a594aec7a5b9ea0";
+      sha256 = "0fdgifjbri7n28hv74zksac05gw72p2czzvyar0jp62b9dnql3mp";
+    })
+  ];
+
+  buildInputs = [ libuuid ]
+    ++ lib.optional (readline != null) readline
+    ++ lib.optional (gettext != null) gettext
+    ++ lib.optional (lvm2 != null) lvm2;
+
+  configureFlags =
+       (if (readline != null)
+        then [ "--with-readline" ]
+        else [ "--without-readline" ])
+    ++ lib.optional (lvm2 == null) "--disable-device-mapper"
+    ++ lib.optional enableStatic "--enable-static";
+
+  doCheck = true;
+  checkInputs = [ check util-linux ];
+
+  meta = with lib; {
+    description = "Create, destroy, resize, check, and copy partitions";
+
+    longDescription = ''
+      GNU Parted is an industrial-strength package for creating, destroying,
+      resizing, checking and copying partitions, and the file systems on
+      them.  This is useful for creating space for new operating systems,
+      reorganising disk usage, copying data on hard disks and disk imaging.
+
+      It contains a library, libparted, and a command-line frontend, parted,
+      which also serves as a sample implementation and script backend.
+    '';
+
+    homepage = "https://www.gnu.org/software/parted/";
+    license = licenses.gpl3Plus;
+
+    maintainers = [
+      # Add your name here!
+    ];
+
+    # GNU Parted requires libuuid, which is part of util-linux-ng.
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pyblock-sysmacros.h.patch b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pyblock-sysmacros.h.patch
new file mode 100644
index 000000000000..b8ab7bd53b2b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pyblock-sysmacros.h.patch
@@ -0,0 +1,12 @@
+diff --git a/dm.c b/dm.c
+index 5daa0e5..d5b84c8 100644
+--- a/dm.c
++++ b/dm.c
+@@ -19,6 +19,7 @@
+ #define _GNU_SOURCE
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/sysmacros.h>
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <stdarg.h>
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pyblock.nix b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pyblock.nix
new file mode 100644
index 000000000000..ddf260300fbc
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pyblock.nix
@@ -0,0 +1,36 @@
+{ lib, stdenv, fetchurl, python, lvm2, dmraid }:
+
+stdenv.mkDerivation rec {
+  pname = "pyblock";
+  version = "0.53";
+  md5_path = "f6d33a8362dee358517d0a9e2ebdd044";
+
+  src = fetchurl {
+    url = "https://src.fedoraproject.org/repo/pkgs/python-pyblock/"
+        + "${pname}-${version}.tar.bz2/${md5_path}/${pname}-${version}.tar.bz2";
+    sha256 = "f6cef88969300a6564498557eeea1d8da58acceae238077852ff261a2cb1d815";
+  };
+
+  patches = [
+    # Fix build with glibc >= 2.28
+    # https://github.com/NixOS/nixpkgs/issues/86403
+    ./pyblock-sysmacros.h.patch
+  ];
+
+  postPatch = ''
+    sed -i -e 's|/usr/include/python|${python}/include/python|' \
+           -e 's/-Werror *//' -e 's|/usr/|'"$out"'/|' Makefile
+  '';
+
+  buildInputs = [ python lvm2 dmraid ];
+
+  makeFlags = [
+    "USESELINUX=0"
+    "SITELIB=$(out)/lib/${python.libPrefix}/site-packages"
+  ];
+
+  meta = with lib; {
+    description = "Interface for working with block devices";
+    license = licenses.gpl2Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pykickstart.nix b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pykickstart.nix
new file mode 100644
index 000000000000..092db8ee7c4c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pykickstart.nix
@@ -0,0 +1,30 @@
+{ lib, python, buildPythonApplication, fetchurl, urlgrabber }:
+
+buildPythonApplication rec {
+  pname = "pykickstart";
+  version = "1.99.39";
+  md5_path = "d249f60aa89b1b4facd63f776925116d";
+
+  src = fetchurl {
+    url = "https://src.fedoraproject.org/repo/pkgs/pykickstart/"
+        + "${pname}-${version}.tar.gz/${md5_path}/${pname}-${version}.tar.gz";
+    sha256 = "e0d0f98ac4c5607e6a48d5c1fba2d50cc804de1081043f9da68cbfc69cad957a";
+  };
+
+  postPatch = ''
+    sed -i -e "s/for tst in tstList/for tst in sorted(tstList, \
+               key=lambda m: m.__name__)/" tests/baseclass.py
+  '';
+
+  propagatedBuildInputs = [ urlgrabber ];
+
+  checkPhase = ''
+    ${python}/bin/${python.executable} tests/baseclass.py -vv
+  '';
+
+  meta = with lib; {
+    homepage = "http://fedoraproject.org/wiki/Pykickstart";
+    description = "Read and write Fedora kickstart files";
+    license = licenses.gpl2Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pyparted.nix b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pyparted.nix
new file mode 100644
index 000000000000..9d1eff2bab77
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pyparted.nix
@@ -0,0 +1,42 @@
+{ lib, stdenv, fetchurl, pkg-config, python, buildPythonApplication, parted, e2fsprogs }:
+
+buildPythonApplication rec {
+  pname = "pyparted";
+  version = "3.10";
+
+  src = fetchurl {
+    url = "https://fedorahosted.org/releases/p/y/pyparted/${pname}-${version}.tar.gz";
+    sha256 = "17wq4invmv1nfazaksf59ymqyvgv3i8h4q03ry2az0s9lldyg3dv";
+  };
+
+  postPatch = ''
+    sed -i -e 's|/sbin/mke2fs|${e2fsprogs}&|' tests/baseclass.py
+    sed -i -e '
+      s|e\.path\.startswith("/tmp/temp-device-")|"temp-device-" in e.path|
+    ' tests/test__ped_ped.py
+  '' + lib.optionalString stdenv.isi686 ''
+    # remove some integers in this test case which overflow on 32bit systems
+    sed -i -r -e '/class *UnitGetSizeTestCase/,/^$/{/[0-9]{11}/d}' \
+      tests/test__ped_ped.py
+  '';
+
+  preConfigure = ''
+    PATH="${parted}/sbin:$PATH"
+  '';
+
+  nativeBuildInputs = [ pkg-config ];
+
+  propagatedBuildInputs = [ parted ];
+
+  checkPhase = ''
+    patchShebangs Makefile
+    make test PYTHON=${python.executable}
+  '';
+
+  meta = with lib; {
+    homepage = "https://fedorahosted.org/pyparted/";
+    description = "Python interface for libparted";
+    license = licenses.gpl2Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/default.nix b/nixpkgs/pkgs/tools/filesystems/nixpart/default.nix
new file mode 100644
index 000000000000..3a63ad9747fe
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/default.nix
@@ -0,0 +1,20 @@
+{ lib, stdenv, fetchurl, buildPythonApplication, blivet }:
+
+buildPythonApplication rec {
+  pname = "nixpart";
+  version = "1.0.0";
+
+  src = fetchurl {
+    url = "https://github.com/aszlig/nixpart/archive/v${version}.tar.gz";
+    sha256 = "0avwd8p47xy9cydlbjxk8pj8q75zyl68gw2w6fnkk78dcb1a3swp";
+  };
+
+  propagatedBuildInputs = [ blivet ];
+
+  meta = {
+    description = "NixOS storage manager/partitioner";
+    license = lib.licenses.gpl2Plus;
+    maintainers = [ lib.maintainers.aszlig ];
+    platforms = lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/ntfs-3g/default.nix b/nixpkgs/pkgs/tools/filesystems/ntfs-3g/default.nix
new file mode 100644
index 000000000000..7039584ea904
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/ntfs-3g/default.nix
@@ -0,0 +1,49 @@
+{lib, stdenv, fetchurl, util-linux, libuuid
+, crypto ? false, libgcrypt, gnutls, pkg-config}:
+
+stdenv.mkDerivation rec {
+  pname = "ntfs3g";
+  version = "2017.3.23";
+
+  outputs = [ "out" "dev" "man" "doc" ];
+
+  buildInputs = [ libuuid ] ++ lib.optionals crypto [ gnutls libgcrypt ];
+  nativeBuildInputs = lib.optional crypto pkg-config;
+
+  src = fetchurl {
+    url = "https://tuxera.com/opensource/ntfs-3g_ntfsprogs-${version}.tgz";
+    sha256 = "1mb228p80hv97pgk3myyvgp975r9mxq56c6bdn1n24kngcfh4niy";
+  };
+
+  patchPhase = ''
+    substituteInPlace src/Makefile.in --replace /sbin '@sbindir@'
+    substituteInPlace ntfsprogs/Makefile.in --replace /sbin '@sbindir@'
+    substituteInPlace libfuse-lite/mount_util.c \
+      --replace /bin/mount ${util-linux}/bin/mount \
+      --replace /bin/umount ${util-linux}/bin/umount
+  '';
+
+  configureFlags = [
+    "--disable-ldconfig"
+    "--exec-prefix=\${prefix}"
+    "--enable-mount-helper"
+    "--enable-posix-acls"
+    "--enable-xattr-mappings"
+    "--${if crypto then "enable" else "disable"}-crypto"
+    "--enable-extras"
+  ];
+
+  postInstall =
+    ''
+      # Prefer ntfs-3g over the ntfs driver in the kernel.
+      ln -sv mount.ntfs-3g $out/sbin/mount.ntfs
+    '';
+
+  meta = with lib; {
+    homepage = "https://www.tuxera.com/community/open-source-ntfs-3g/";
+    description = "FUSE-based NTFS driver with full write support";
+    maintainers = with maintainers; [ dezgeg ];
+    platforms = platforms.linux;
+    license = licenses.gpl2Plus; # and (lib)fuse-lite under LGPL2+
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/orangefs/default.nix b/nixpkgs/pkgs/tools/filesystems/orangefs/default.nix
new file mode 100644
index 000000000000..f6a35437fb92
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/orangefs/default.nix
@@ -0,0 +1,61 @@
+{ lib, stdenv, fetchurl, bison, flex, autoreconfHook
+, openssl, db, attr, perl, tcsh
+} :
+
+stdenv.mkDerivation rec {
+  pname = "orangefs";
+  version = "2.9.8";
+
+  src = fetchurl {
+    url = "http://download.orangefs.org/current/source/orangefs-${version}.tar.gz";
+    sha256 = "0c2yla615j04ygclfavh8g5miqhbml2r0zs2c5mvkacf9in7p7sq";
+  };
+
+  nativeBuildInputs = [ bison flex perl autoreconfHook ];
+  buildInputs = [ openssl db attr tcsh ];
+
+  postPatch = ''
+    # Issue introduced by attr-2.4.48
+    substituteInPlace src/apps/user/ofs_setdirhint.c --replace attr/xattr.h sys/xattr.h
+
+    # Do not try to install empty sysconfdir
+    substituteInPlace Makefile.in --replace 'install -d $(sysconfdir)' ""
+
+    # perl interpreter needs to be fixed or build fails
+    patchShebangs ./src/apps/admin/pvfs2-genconfig
+
+    # symlink points to a location in /usr
+    rm ./src/client/webpack/ltmain.sh
+  '';
+
+  configureFlags = [
+    "--sysconfdir=/etc/orangefs"
+    "--enable-shared"
+    "--enable-fast"
+    "--with-ssl=${lib.getDev openssl}"
+  ];
+
+
+  enableParallelBuilding = true;
+
+  postInstall = ''
+    # install useful helper scripts
+    install examples/keys/pvfs2-gen-keys.sh $out/bin
+  '';
+
+  postFixup = ''
+    for f in pvfs2-getmattr pvfs2-setmattr; do
+      substituteInPlace $out/bin/$f --replace '#!/bin/csh' '#!${tcsh}/bin/tcsh'
+    done
+
+    sed -i 's:openssl:${openssl}/bin/openssl:' $out/bin/pvfs2-gen-keys.sh
+  '';
+
+  meta = with lib; {
+    description = "Scale-out network file system for use on high-end computing systems";
+    homepage = "http://www.orangefs.org/";
+    license = with licenses;  [ asl20 bsd3 gpl2 lgpl21 lgpl21Plus openldap ];
+    platforms = [ "x86_64-linux" ];
+    maintainers = with maintainers; [ markuskowa ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/rar2fs/default.nix b/nixpkgs/pkgs/tools/filesystems/rar2fs/default.nix
new file mode 100644
index 000000000000..a3056a80aa1f
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/rar2fs/default.nix
@@ -0,0 +1,39 @@
+{ lib, stdenv
+, fetchFromGitHub
+, autoreconfHook
+, fuse
+, unrar
+}:
+
+stdenv.mkDerivation rec {
+  pname = "rar2fs";
+  version = "1.29.2";
+
+  src = fetchFromGitHub {
+    owner = "hasse69";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "0j7ai0gcbln2lyfc87xxmj0zpf3lnqa6fdm5rar3kdqhczb7s93y";
+  };
+
+  postPatch = ''
+    substituteInPlace get-version.sh \
+      --replace "which echo" "echo"
+  '';
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [ fuse unrar ];
+
+  configureFlags = [
+    "--with-unrar=${unrar.dev}/include/unrar"
+    "--disable-static-unrar"
+  ];
+
+  meta = with lib; {
+    description = "FUSE file system for reading RAR archives";
+    homepage = "https://hasse69.github.io/rar2fs/";
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ kraem ];
+    platforms = with platforms; linux ++ freebsd;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/rdfind/default.nix b/nixpkgs/pkgs/tools/filesystems/rdfind/default.nix
new file mode 100644
index 000000000000..08562aed3635
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/rdfind/default.nix
@@ -0,0 +1,21 @@
+{ lib, stdenv, fetchurl, nettle }:
+
+stdenv.mkDerivation rec {
+  pname = "rdfind";
+  version = "1.4.1";
+
+  src = fetchurl {
+    url = "https://rdfind.pauldreik.se/${pname}-${version}.tar.gz";
+    sha256 = "132y3wwgnbpdx6f90q0yahd3nkr4cjzcy815ilc8p97b4vn17iih";
+  };
+
+  buildInputs = [ nettle ];
+
+  meta = with lib; {
+    homepage = "https://rdfind.pauldreik.se/";
+    description = "Removes or hardlinks duplicate files very swiftly";
+    license = lib.licenses.gpl2;
+    maintainers = [ maintainers.wmertens ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/reiser4progs/default.nix b/nixpkgs/pkgs/tools/filesystems/reiser4progs/default.nix
new file mode 100644
index 000000000000..46c0120f64c4
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/reiser4progs/default.nix
@@ -0,0 +1,32 @@
+{lib, stdenv, fetchurl, libaal}:
+
+let version = "2.0.1"; in
+stdenv.mkDerivation rec {
+  pname = "reiser4progs";
+  inherit version;
+
+  src = fetchurl {
+    url = "mirror://sourceforge/reiser4/reiser4-utils/${pname}-${version}.tar.gz";
+    sha256 = "1r7m95mnp6xmp1j5k99jhmz6g9y2qq7cghlmdxsfbr3xviqfs45d";
+  };
+
+  buildInputs = [libaal];
+
+  hardeningDisable = [ "format" ];
+
+  preConfigure = ''
+    substituteInPlace configure --replace " -static" ""
+  '';
+
+  preInstall = ''
+    substituteInPlace Makefile --replace ./run-ldconfig true
+  '';
+
+  meta = with lib; {
+    inherit version;
+    homepage = "https://sourceforge.net/projects/reiser4/";
+    description = "Reiser4 utilities";
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/reiserfsprogs/default.nix b/nixpkgs/pkgs/tools/filesystems/reiserfsprogs/default.nix
new file mode 100644
index 000000000000..dc97cdb652e2
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/reiserfsprogs/default.nix
@@ -0,0 +1,26 @@
+{ lib, stdenv, fetchurl, libuuid, autoreconfHook }:
+
+let version = "3.6.24"; in
+stdenv.mkDerivation rec {
+  pname = "reiserfsprogs";
+  inherit version;
+
+  src = fetchurl {
+    url = "https://www.kernel.org/pub/linux/kernel/people/jeffm/reiserfsprogs/v${version}/${pname}-${version}.tar.xz";
+    sha256 = "0q07df9wxxih8714a3mdp61h5n347l7j2a0l351acs3xapzgwi3y";
+  };
+
+  patches = [ ./reiserfsprogs-ar-fix.patch ];
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [ libuuid ];
+
+  NIX_CFLAGS_COMPILE = [ "-std=gnu90" "-D_GNU_SOURCE" ];
+
+  meta = {
+    inherit version;
+    homepage = "http://www.namesys.com/";
+    description = "ReiserFS utilities";
+    license = lib.licenses.gpl2;
+    platforms = lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/reiserfsprogs/reiserfsprogs-ar-fix.patch b/nixpkgs/pkgs/tools/filesystems/reiserfsprogs/reiserfsprogs-ar-fix.patch
new file mode 100644
index 000000000000..356782a3d984
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/reiserfsprogs/reiserfsprogs-ar-fix.patch
@@ -0,0 +1,10 @@
+--- reiserfsprogs-3.6.24/configure.ac.orig	2018-11-29 17:16:52.313624894 +0300
++++ reiserfsprogs-3.6.24/configure.ac	2018-11-29 17:16:54.480669132 +0300
+@@ -21,6 +21,7 @@
+ AC_PROG_LN_S
+ AC_PROG_MAKE_SET
+ AC_PROG_RANLIB
++AM_PROG_AR
+ 
+ dnl Checks for libraries.
+ 
diff --git a/nixpkgs/pkgs/tools/filesystems/rmount/default.nix b/nixpkgs/pkgs/tools/filesystems/rmount/default.nix
new file mode 100644
index 000000000000..96d950e74ff1
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/rmount/default.nix
@@ -0,0 +1,32 @@
+{ lib, stdenv, nmap, jq, cifs-utils, sshfs, fetchFromGitHub, makeWrapper }:
+
+stdenv.mkDerivation rec {
+
+  pname   = "rmount";
+  version = "1.1.0";
+
+  src = fetchFromGitHub {
+    rev = "v${version}";
+    owner = "Luis-Hebendanz";
+    repo = "rmount";
+    sha256 = "0j1ayncw1nnmgna7vyx44vwinh4ah1b0l5y8agc7i4s8clbvy3h0";
+  };
+
+  buildInputs = [ makeWrapper ];
+
+  installPhase = ''
+    install -D ${src}/rmount.man  $out/share/man/man1/rmount.1
+    install -D ${src}/rmount.bash $out/bin/rmount
+    install -D ${src}/config.json $out/share/config.json
+
+    wrapProgram $out/bin/rmount --prefix PATH : ${lib.makeBinPath [ nmap jq cifs-utils sshfs ]}
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/Luis-Hebendanz/rmount";
+    description = "Remote mount utility which parses a json file";
+    license = licenses.mit;
+    maintainers = [ maintainers.luis ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/romdirfs/default.nix b/nixpkgs/pkgs/tools/filesystems/romdirfs/default.nix
new file mode 100644
index 000000000000..b4fa173706e2
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/romdirfs/default.nix
@@ -0,0 +1,24 @@
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, fuse }:
+
+stdenv.mkDerivation rec {
+  pname = "romdirfs";
+  version = "1.2";
+
+  src = fetchFromGitHub {
+    owner = "mlafeldt";
+    repo = "romdirfs";
+    rev = "v${version}";
+    sha256 = "1jbsmpklrycz5q86qmzvbz4iz2g5fvd7p9nca160aw2izwpws0g7";
+  };
+
+  nativeBuildInputs = [ cmake pkg-config ];
+  buildInputs = [ fuse ];
+
+  meta = with lib; {
+    description = "FUSE for access Playstation 2 IOP IOPRP images and BIOS dumps";
+    homepage = "https://github.com/mlafeldt/romdirfs";
+    license = licenses.gpl3;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/s3backer/default.nix b/nixpkgs/pkgs/tools/filesystems/s3backer/default.nix
new file mode 100644
index 000000000000..650fd713a0ed
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/s3backer/default.nix
@@ -0,0 +1,30 @@
+{ lib, stdenv, fetchFromGitHub
+, autoreconfHook, pkg-config
+, fuse, curl, expat }:
+
+stdenv.mkDerivation rec {
+  pname = "s3backer";
+  version = "1.5.4";
+
+  src = fetchFromGitHub {
+    sha256 = "1228qlfgz48k9vv72hrz488zg73zls99cppb9vmikc0pzv1xndsx";
+    rev = version;
+    repo = "s3backer";
+    owner = "archiecobbs";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkg-config ];
+  buildInputs = [ fuse curl expat ];
+
+  autoreconfPhase = ''
+    patchShebangs ./autogen.sh
+    ./autogen.sh
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/archiecobbs/s3backer";
+    description = "FUSE-based single file backing store via Amazon S3";
+    license = licenses.gpl2Plus;
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/s3fs/default.nix b/nixpkgs/pkgs/tools/filesystems/s3fs/default.nix
new file mode 100644
index 000000000000..4ff36e3b1d87
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/s3fs/default.nix
@@ -0,0 +1,32 @@
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, curl, openssl, libxml2, fuse, osxfuse }:
+
+stdenv.mkDerivation rec {
+  pname = "s3fs-fuse";
+  version = "1.88";
+
+  src = fetchFromGitHub {
+    owner  = "s3fs-fuse";
+    repo   = "s3fs-fuse";
+    rev    = "v${version}";
+    sha256 = "sha256-LxqTKu9F8FqHnjp1a9E/+WbH1Ol6if/OpY7LGsVE9Bw=";
+  };
+
+  buildInputs = [ curl openssl libxml2 ]
+    ++ lib.optionals stdenv.isLinux [ fuse ]
+    ++ lib.optionals stdenv.isDarwin [ osxfuse ];
+  nativeBuildInputs = [ autoreconfHook pkg-config ];
+
+  configureFlags = [
+    "--with-openssl"
+  ];
+
+  postInstall = ''
+    ln -s $out/bin/s3fs $out/bin/mount.s3fs
+  '';
+
+  meta = with lib; {
+    description = "Mount an S3 bucket as filesystem through FUSE";
+    license = licenses.gpl2;
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/sandboxfs/Cargo.lock.patch b/nixpkgs/pkgs/tools/filesystems/sandboxfs/Cargo.lock.patch
new file mode 100644
index 000000000000..fbc4c80872cf
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/sandboxfs/Cargo.lock.patch
@@ -0,0 +1,640 @@
+diff --git a/Cargo.lock b/Cargo.lock
+new file mode 100644
+index 0000000..5e16611
+--- /dev/null
++++ b/Cargo.lock
+@@ -0,0 +1,634 @@
++# This file is automatically @generated by Cargo.
++# It is not intended for manual editing.
++[[package]]
++name = "addr2line"
++version = "0.13.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072"
++dependencies = [
++ "gimli",
++]
++
++[[package]]
++name = "adler"
++version = "0.2.3"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e"
++
++[[package]]
++name = "aho-corasick"
++version = "0.7.13"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86"
++dependencies = [
++ "memchr",
++]
++
++[[package]]
++name = "arc-swap"
++version = "0.4.7"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034"
++
++[[package]]
++name = "atty"
++version = "0.2.14"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
++dependencies = [
++ "hermit-abi",
++ "libc",
++ "winapi",
++]
++
++[[package]]
++name = "autocfg"
++version = "1.0.1"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
++
++[[package]]
++name = "backtrace"
++version = "0.3.51"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "ec1931848a574faa8f7c71a12ea00453ff5effbb5f51afe7f77d7a48cace6ac1"
++dependencies = [
++ "addr2line",
++ "cfg-if",
++ "libc",
++ "miniz_oxide",
++ "object",
++ "rustc-demangle",
++]
++
++[[package]]
++name = "bitflags"
++version = "1.2.1"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
++
++[[package]]
++name = "cc"
++version = "1.0.60"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c"
++
++[[package]]
++name = "cfg-if"
++version = "0.1.10"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
++
++[[package]]
++name = "cpuprofiler"
++version = "0.0.4"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "43f8479dbcfd2bbaa0c0c26779b913052b375981cdf533091f2127ea3d42e52b"
++dependencies = [
++ "error-chain",
++ "lazy_static",
++ "pkg-config",
++]
++
++[[package]]
++name = "env_logger"
++version = "0.5.13"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38"
++dependencies = [
++ "atty",
++ "humantime",
++ "log 0.4.11",
++ "regex",
++ "termcolor",
++]
++
++[[package]]
++name = "error-chain"
++version = "0.12.4"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc"
++dependencies = [
++ "backtrace",
++ "version_check",
++]
++
++[[package]]
++name = "failure"
++version = "0.1.8"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86"
++dependencies = [
++ "backtrace",
++ "failure_derive",
++]
++
++[[package]]
++name = "failure_derive"
++version = "0.1.8"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4"
++dependencies = [
++ "proc-macro2",
++ "quote",
++ "syn",
++ "synstructure",
++]
++
++[[package]]
++name = "fuse"
++version = "0.3.1"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "80e57070510966bfef93662a81cb8aa2b1c7db0964354fa9921434f04b9e8660"
++dependencies = [
++ "libc",
++ "log 0.3.9",
++ "pkg-config",
++ "thread-scoped",
++ "time",
++]
++
++[[package]]
++name = "getopts"
++version = "0.2.21"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5"
++dependencies = [
++ "unicode-width",
++]
++
++[[package]]
++name = "getrandom"
++version = "0.1.15"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6"
++dependencies = [
++ "cfg-if",
++ "libc",
++ "wasi 0.9.0+wasi-snapshot-preview1",
++]
++
++[[package]]
++name = "gimli"
++version = "0.22.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724"
++
++[[package]]
++name = "hermit-abi"
++version = "0.1.16"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "4c30f6d0bc6b00693347368a67d41b58f2fb851215ff1da49e90fe2c5c667151"
++dependencies = [
++ "libc",
++]
++
++[[package]]
++name = "humantime"
++version = "1.3.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
++dependencies = [
++ "quick-error",
++]
++
++[[package]]
++name = "itoa"
++version = "0.4.6"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6"
++
++[[package]]
++name = "lazy_static"
++version = "1.4.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
++
++[[package]]
++name = "libc"
++version = "0.2.78"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "aa7087f49d294270db4e1928fc110c976cd4b9e5a16348e0a1df09afa99e6c98"
++
++[[package]]
++name = "log"
++version = "0.3.9"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
++dependencies = [
++ "log 0.4.11",
++]
++
++[[package]]
++name = "log"
++version = "0.4.11"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
++dependencies = [
++ "cfg-if",
++]
++
++[[package]]
++name = "memchr"
++version = "2.3.3"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
++
++[[package]]
++name = "miniz_oxide"
++version = "0.4.2"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "c60c0dfe32c10b43a144bad8fc83538c52f58302c92300ea7ec7bf7b38d5a7b9"
++dependencies = [
++ "adler",
++ "autocfg",
++]
++
++[[package]]
++name = "nix"
++version = "0.12.1"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "319fffb13b63c0f4ff5a4e1c97566e7e741561ff5d03bf8bbf11653454bbd70b"
++dependencies = [
++ "bitflags",
++ "cc",
++ "cfg-if",
++ "libc",
++ "void",
++]
++
++[[package]]
++name = "num_cpus"
++version = "1.13.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
++dependencies = [
++ "hermit-abi",
++ "libc",
++]
++
++[[package]]
++name = "object"
++version = "0.20.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5"
++
++[[package]]
++name = "pkg-config"
++version = "0.3.18"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33"
++
++[[package]]
++name = "ppv-lite86"
++version = "0.2.9"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20"
++
++[[package]]
++name = "proc-macro2"
++version = "1.0.24"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
++dependencies = [
++ "unicode-xid",
++]
++
++[[package]]
++name = "quick-error"
++version = "1.2.3"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
++
++[[package]]
++name = "quote"
++version = "1.0.7"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
++dependencies = [
++ "proc-macro2",
++]
++
++[[package]]
++name = "rand"
++version = "0.7.3"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
++dependencies = [
++ "getrandom",
++ "libc",
++ "rand_chacha",
++ "rand_core",
++ "rand_hc",
++]
++
++[[package]]
++name = "rand_chacha"
++version = "0.2.2"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
++dependencies = [
++ "ppv-lite86",
++ "rand_core",
++]
++
++[[package]]
++name = "rand_core"
++version = "0.5.1"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
++dependencies = [
++ "getrandom",
++]
++
++[[package]]
++name = "rand_hc"
++version = "0.2.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
++dependencies = [
++ "rand_core",
++]
++
++[[package]]
++name = "redox_syscall"
++version = "0.1.57"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
++
++[[package]]
++name = "regex"
++version = "1.3.9"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6"
++dependencies = [
++ "aho-corasick",
++ "memchr",
++ "regex-syntax",
++ "thread_local",
++]
++
++[[package]]
++name = "regex-syntax"
++version = "0.6.18"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8"
++
++[[package]]
++name = "remove_dir_all"
++version = "0.5.3"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
++dependencies = [
++ "winapi",
++]
++
++[[package]]
++name = "rustc-demangle"
++version = "0.1.16"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
++
++[[package]]
++name = "ryu"
++version = "1.0.5"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
++
++[[package]]
++name = "sandboxfs"
++version = "0.2.0"
++dependencies = [
++ "cpuprofiler",
++ "env_logger",
++ "failure",
++ "fuse",
++ "getopts",
++ "log 0.4.11",
++ "nix",
++ "num_cpus",
++ "pkg-config",
++ "serde",
++ "serde_derive",
++ "serde_json",
++ "signal-hook",
++ "tempfile",
++ "threadpool",
++ "time",
++ "users",
++ "xattr",
++]
++
++[[package]]
++name = "serde"
++version = "1.0.116"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "96fe57af81d28386a513cbc6858332abc6117cfdb5999647c6444b8f43a370a5"
++
++[[package]]
++name = "serde_derive"
++version = "1.0.116"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "f630a6370fd8e457873b4bd2ffdae75408bc291ba72be773772a4c2a065d9ae8"
++dependencies = [
++ "proc-macro2",
++ "quote",
++ "syn",
++]
++
++[[package]]
++name = "serde_json"
++version = "1.0.58"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "a230ea9107ca2220eea9d46de97eddcb04cd00e92d13dda78e478dd33fa82bd4"
++dependencies = [
++ "itoa",
++ "ryu",
++ "serde",
++]
++
++[[package]]
++name = "signal-hook"
++version = "0.1.16"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "604508c1418b99dfe1925ca9224829bb2a8a9a04dda655cc01fcad46f4ab05ed"
++dependencies = [
++ "libc",
++ "signal-hook-registry",
++]
++
++[[package]]
++name = "signal-hook-registry"
++version = "1.2.1"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "a3e12110bc539e657a646068aaf5eb5b63af9d0c1f7b29c97113fad80e15f035"
++dependencies = [
++ "arc-swap",
++ "libc",
++]
++
++[[package]]
++name = "syn"
++version = "1.0.42"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "9c51d92969d209b54a98397e1b91c8ae82d8c87a7bb87df0b29aa2ad81454228"
++dependencies = [
++ "proc-macro2",
++ "quote",
++ "unicode-xid",
++]
++
++[[package]]
++name = "synstructure"
++version = "0.12.4"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701"
++dependencies = [
++ "proc-macro2",
++ "quote",
++ "syn",
++ "unicode-xid",
++]
++
++[[package]]
++name = "tempfile"
++version = "3.1.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
++dependencies = [
++ "cfg-if",
++ "libc",
++ "rand",
++ "redox_syscall",
++ "remove_dir_all",
++ "winapi",
++]
++
++[[package]]
++name = "termcolor"
++version = "1.1.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f"
++dependencies = [
++ "winapi-util",
++]
++
++[[package]]
++name = "thread-scoped"
++version = "1.0.2"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "bcbb6aa301e5d3b0b5ef639c9a9c7e2f1c944f177b460c04dc24c69b1fa2bd99"
++
++[[package]]
++name = "thread_local"
++version = "1.0.1"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
++dependencies = [
++ "lazy_static",
++]
++
++[[package]]
++name = "threadpool"
++version = "1.8.1"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa"
++dependencies = [
++ "num_cpus",
++]
++
++[[package]]
++name = "time"
++version = "0.1.44"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
++dependencies = [
++ "libc",
++ "wasi 0.10.0+wasi-snapshot-preview1",
++ "winapi",
++]
++
++[[package]]
++name = "unicode-width"
++version = "0.1.8"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
++
++[[package]]
++name = "unicode-xid"
++version = "0.2.1"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
++
++[[package]]
++name = "users"
++version = "0.9.1"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "c72f4267aea0c3ec6d07eaabea6ead7c5ddacfafc5e22bcf8d186706851fb4cf"
++dependencies = [
++ "libc",
++]
++
++[[package]]
++name = "version_check"
++version = "0.9.2"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
++
++[[package]]
++name = "void"
++version = "1.0.2"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
++
++[[package]]
++name = "wasi"
++version = "0.9.0+wasi-snapshot-preview1"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
++
++[[package]]
++name = "wasi"
++version = "0.10.0+wasi-snapshot-preview1"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
++
++[[package]]
++name = "winapi"
++version = "0.3.9"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
++dependencies = [
++ "winapi-i686-pc-windows-gnu",
++ "winapi-x86_64-pc-windows-gnu",
++]
++
++[[package]]
++name = "winapi-i686-pc-windows-gnu"
++version = "0.4.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
++
++[[package]]
++name = "winapi-util"
++version = "0.1.5"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
++dependencies = [
++ "winapi",
++]
++
++[[package]]
++name = "winapi-x86_64-pc-windows-gnu"
++version = "0.4.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
++
++[[package]]
++name = "xattr"
++version = "0.2.2"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c"
++dependencies = [
++ "libc",
++]
diff --git a/nixpkgs/pkgs/tools/filesystems/sandboxfs/default.nix b/nixpkgs/pkgs/tools/filesystems/sandboxfs/default.nix
new file mode 100644
index 000000000000..8777fa50a5d8
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/sandboxfs/default.nix
@@ -0,0 +1,37 @@
+{ lib, stdenv
+, fetchFromGitHub
+, rustPlatform
+, fuse
+, pkg-config
+, installShellFiles
+}:
+
+rustPlatform.buildRustPackage rec {
+  pname = "sandboxfs";
+  version = "0.2.0";
+
+  src = fetchFromGitHub {
+    owner = "bazelbuild";
+    repo = pname;
+    rev = "sandboxfs-${version}";
+    sha256 = "Ia6rq6FN4abnvLXjlQh4Q+8ra5JThKnC86UXC7s9//U=";
+  };
+
+  cargoSha256 = "sha256-k303TjWG+n+/ZMmko84KJtYb7swuQ1ZJOc4Vq6aOhX0=";
+
+  # Issue to add Cargo.lock upstream: https://github.com/bazelbuild/sandboxfs/pull/115
+  cargoPatches = [ ./Cargo.lock.patch ];
+
+  nativeBuildInputs = [ pkg-config installShellFiles ];
+
+  buildInputs = [ fuse ];
+
+  postInstall = "installManPage man/sandboxfs.1";
+
+  meta = with lib; {
+    description = "A virtual file system for sandboxing";
+    homepage = "https://github.com/bazelbuild/sandboxfs";
+    license = with licenses; [ asl20 ];
+    maintainers = with maintainers; [ jeremyschlatter ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/sasquatch/default.nix b/nixpkgs/pkgs/tools/filesystems/sasquatch/default.nix
new file mode 100644
index 000000000000..7f92da6a224d
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/sasquatch/default.nix
@@ -0,0 +1,53 @@
+{ fetchFromGitHub
+, fetchurl
+, lz4 ? null
+, lz4Support ? false
+, lzma
+, lzo
+, lib, stdenv
+, xz
+, zlib
+}:
+
+assert lz4Support -> (lz4 != null);
+
+let
+  patch = fetchFromGitHub {
+    owner = "devttys0";
+    repo = "sasquatch";
+    rev = "3e0cc40fc6dbe32bd3a5e6c553b3320d5d91ceed";
+    sha256 = "19lhndjv7v9w6nmszry63zh5rqii9v7wvsbpc2n6q606hyz955g2";
+  } + "/patches/patch0.txt";
+in
+stdenv.mkDerivation rec {
+  pname = "sasquatch";
+  version = "4.3";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/squashfs/squashfs4.3.tar.gz";
+    sha256 = "1xpklm0y43nd9i6jw43y2xh5zvlmj9ar2rvknh0bh7kv8c95aq0d";
+  };
+
+  buildInputs = [ lzma lzo xz zlib ]
+    ++ lib.optional lz4Support lz4;
+
+  patches = [ patch ];
+  patchFlags = [ "-p0" ];
+
+  postPatch = ''
+    cd squashfs-tools
+  '';
+
+  installFlags = [ "INSTALL_DIR=\${out}/bin" ];
+
+  makeFlags = [ "XZ_SUPPORT=1" ]
+    ++ lib.optional lz4Support "LZ4_SUPPORT=1";
+
+  meta = with lib; {
+    homepage = "https://github.com/devttys0/sasquatch";
+    description = "Set of patches to the standard unsquashfs utility (part of squashfs-tools) that attempts to add support for as many hacked-up vendor-specific SquashFS implementations as possible";
+    license = licenses.gpl2Plus;
+    maintainers = [ maintainers.pamplemousse ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/securefs/default.nix b/nixpkgs/pkgs/tools/filesystems/securefs/default.nix
new file mode 100644
index 000000000000..235d8a53fe72
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/securefs/default.nix
@@ -0,0 +1,36 @@
+{ lib, stdenv, fetchFromGitHub
+, cmake
+, fuse }:
+
+stdenv.mkDerivation rec {
+  pname = "securefs";
+  version = "0.11.1";
+
+  src = fetchFromGitHub {
+    sha256 = "1sxfgqgy63ml7vg7zj3glvra4wj2qmfv9jzmpm1jqy8hq7qlqlsx";
+    rev = version;
+    repo = "securefs";
+    owner = "netheril96";
+    fetchSubmodules = true;
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ fuse ];
+
+  meta = with lib; {
+    inherit (src.meta) homepage;
+    description = "Transparent encryption filesystem";
+    longDescription = ''
+      Securefs is a filesystem in userspace (FUSE) that transparently encrypts
+      and authenticates data stored. It is particularly designed to secure
+      data stored in the cloud.
+      Securefs mounts a regular directory onto a mount point. The mount point
+      appears as a regular filesystem, where one can read/write/create files,
+      directories and symbolic links. The underlying directory will be
+      automatically updated to contain the encrypted and authenticated
+      contents.
+    '';
+    license = with licenses; [ bsd2 mit ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/sftpman/default.nix b/nixpkgs/pkgs/tools/filesystems/sftpman/default.nix
new file mode 100644
index 000000000000..e89012b76f63
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/sftpman/default.nix
@@ -0,0 +1,25 @@
+{ lib, python3Packages, fetchFromGitHub }:
+
+python3Packages.buildPythonApplication rec {
+  pname = "sftpman";
+  version = "1.1.3";
+
+  src = fetchFromGitHub {
+    owner = "spantaleev";
+    repo = pname;
+    rev = version;
+    sha256 = "04awwwfw51fi1q18xdysp54jyhr0rhb4kfyrgv0vhhrlpwwyhnqy";
+  };
+
+  checkPhase = ''
+    $out/bin/sftpman help
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/spantaleev/sftpman";
+    description = "Application that handles sshfs/sftp file systems mounting";
+    license = licenses.gpl3;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ contrun ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/simg2img/default.nix b/nixpkgs/pkgs/tools/filesystems/simg2img/default.nix
new file mode 100644
index 000000000000..d0d7304c9d20
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/simg2img/default.nix
@@ -0,0 +1,25 @@
+{ lib, stdenv, fetchFromGitHub, zlib }:
+
+stdenv.mkDerivation rec {
+  pname = "simg2img";
+  version = "1.1.4";
+
+  src = fetchFromGitHub {
+    owner = "anestisb";
+    repo = "android-simg2img";
+    rev = version;
+    sha256 = "1xm9kaqs2w8c7a4psv78gv66gild88mpgjn5lj087d7jh1jxy7bf";
+  };
+
+  buildInputs = [ zlib ];
+
+  makeFlags = [ "PREFIX=$(out)" ];
+
+  meta = with lib; {
+    description = "Tool to convert Android sparse images to raw images";
+    homepage = "https://github.com/anestisb/android-simg2img";
+    license = licenses.asl20;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.dezgeg ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/smbnetfs/default.nix b/nixpkgs/pkgs/tools/filesystems/smbnetfs/default.nix
new file mode 100644
index 000000000000..05d7189fbaac
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/smbnetfs/default.nix
@@ -0,0 +1,28 @@
+{ lib, stdenv, fetchurl, fuse, samba, pkg-config, glib, autoconf, attr, libsecret }:
+
+stdenv.mkDerivation rec {
+  pname = "smbnetfs";
+  version = "0.6.2";
+  src = fetchurl {
+    url = "mirror://sourceforge/project/smbnetfs/smbnetfs/SMBNetFS-${version}/${pname}-${version}.tar.bz2";
+    sha256 = "19x9978k90w9a65lrpsphk7swsq8zkws9jc27q4zbndrm0r2snr0";
+  };
+
+  nativeBuildInputs = [ pkg-config autoconf ];
+  buildInputs = [ fuse samba glib attr libsecret ];
+
+  postPatch = ''
+    substituteInPlace src/function.c --replace "attr/xattr.h" "sys/xattr.h"
+  '';
+
+  meta = with lib; {
+    description = "A FUSE FS for mounting Samba shares";
+    maintainers = with maintainers; [ raskin ];
+    platforms = platforms.linux;
+    license = licenses.gpl2;
+    downloadPage = "https://sourceforge.net/projects/smbnetfs/files/smbnetfs";
+    updateWalker = true;
+    inherit version;
+    homepage = "https://sourceforge.net/projects/smbnetfs/";
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/smbnetfs/default.upstream b/nixpkgs/pkgs/tools/filesystems/smbnetfs/default.upstream
new file mode 100644
index 000000000000..d56fa42f1d1b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/smbnetfs/default.upstream
@@ -0,0 +1,6 @@
+url https://sourceforge.net/projects/smbnetfs/files/smbnetfs/
+version_link '[-][0-9.]+[a-z]*/$'
+version_link '[.]tar[.][a-z0-9]+/download$'
+SF_redirect
+version '.*[-]([0-9.]+[a-z]*)[.]tar[.].*' '\1'
+do_overwrite () { do_overwrite_just_version; }
diff --git a/nixpkgs/pkgs/tools/filesystems/snapraid/default.nix b/nixpkgs/pkgs/tools/filesystems/snapraid/default.nix
new file mode 100644
index 000000000000..d854558b7920
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/snapraid/default.nix
@@ -0,0 +1,28 @@
+{ lib, stdenv, fetchFromGitHub, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  pname = "snapraid";
+  version = "11.5";
+
+  src = fetchFromGitHub {
+    owner = "amadvance";
+    repo = "snapraid";
+    rev = "v${version}";
+    sha256 = "0dlhdsmq5l208zldfr9z9g0p67wry81dr0r23lpybb5c9fm2f2rm";
+  };
+
+  VERSION = version;
+
+  doCheck = true;
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [ ];
+
+  meta = {
+    homepage = "http://www.snapraid.it/";
+    description = "A backup program for disk arrays";
+    license = lib.licenses.gpl3;
+    maintainers = [ lib.maintainers.makefu ];
+    platforms = lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/squashfs-tools-ng/default.nix b/nixpkgs/pkgs/tools/filesystems/squashfs-tools-ng/default.nix
new file mode 100644
index 000000000000..593004d552c1
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/squashfs-tools-ng/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, lib, fetchurl, doxygen, graphviz, perl, pkg-config
+, lz4, lzo, xz, zlib, zstd
+}:
+
+stdenv.mkDerivation rec {
+  pname = "squashfs-tools-ng";
+  version = "1.0.1";
+
+  src = fetchurl {
+    url = "https://infraroot.at/pub/squashfs/squashfs-tools-ng-${version}.tar.xz";
+    sha256 = "120x2hlbhpm90bzxz70z764552ffrjpidmp1y6gafx70zp0hrks4";
+  };
+
+  nativeBuildInputs = [ doxygen graphviz pkg-config perl ];
+  buildInputs = [ zlib xz lz4 lzo zstd ];
+
+  meta = with lib; {
+    homepage = "https://github.com/AgentD/squashfs-tools-ng";
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ qyliss ];
+    platforms = platforms.unix;
+    broken = stdenv.isDarwin;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/squashfs/4k-align.patch b/nixpkgs/pkgs/tools/filesystems/squashfs/4k-align.patch
new file mode 100644
index 000000000000..e73c06788756
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/squashfs/4k-align.patch
@@ -0,0 +1,98 @@
+This patch has been edited to apply to squashfs 4.4, commit
+52eb4c279cd283ed9802dd1ceb686560b22ffb67. Below is the original
+message body of the patch.
+
+From 7bda7c75748f36b0a50f93e46144d5a4de4974ad Mon Sep 17 00:00:00 2001
+From: Amin Hassani <ahassani@google.com>
+Date: Thu, 15 Dec 2016 10:43:15 -0800
+Subject: [PATCH] mksquashfs 4K aligns the files inside the squashfs image
+
+Files inside a squashfs image are not necessarily 4k (4096)
+aligned. This patch starts each file in a 4k aligned address and pads
+zero to the end of the file until it reaches the next 4k aligned
+address. This will not change the size of the compressed
+blocks (especially the last one) and hence it will not change how the
+files are being loaded in kernel or unsquashfs. However on average this
+increases the size of the squashfs image which can be calculated by the
+following formula:
+
+increased_size = (number_of_unfragmented_files_in_image + number of fragments) * 2048
+
+The 4k alignment can be enabled by flag '-4k-align'
+---
+ squashfs-tools/mksquashfs.c | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c
+index a45b77f..07b1c06 100644
+--- a/squashfs-tools/mksquashfs.c
++++ b/squashfs-tools/mksquashfs.c
+@@ -102,7 +102,9 @@ int old_exclude = TRUE;
+ int use_regex = FALSE;
+ int nopad = FALSE;
+ int exit_on_error = FALSE;
++int do_4k_align = FALSE;
+ long long start_offset = 0;
++#define ALIGN_UP(bytes, size) (bytes = (bytes + size - 1) & ~(size - 1))
+ 
+ long long global_uid = -1, global_gid = -1;
+ 
+@@ -1546,6 +1548,9 @@ void unlock_fragments()
+ 	 * queue at this time.
+ 	 */
+ 	while(!queue_empty(locked_fragment)) {
++		// 4k align the start of remaining queued fragments.
++		if(do_4k_align)
++			ALIGN_UP(bytes, 4096);
+ 		write_buffer = queue_get(locked_fragment);
+ 		frg = write_buffer->block;	
+ 		size = SQUASHFS_COMPRESSED_SIZE_BLOCK(fragment_table[frg].size);
+@@ -2478,6 +2483,9 @@ void *frag_deflator(void *arg)
+ 		write_buffer->size = compressed_size;
+ 		pthread_mutex_lock(&fragment_mutex);
+ 		if(fragments_locked == FALSE) {
++			// 4k align the start of each fragment.
++			if(do_4k_align)
++				ALIGN_UP(bytes, 4096);
+ 			fragment_table[file_buffer->block].size = c_byte;
+ 			fragment_table[file_buffer->block].start_block = bytes;
+ 			write_buffer->block = bytes;
+@@ -2877,6 +2885,10 @@ int write_file_blocks(squashfs_inode *inode, struct dir_ent *dir_ent,
+ 	long long sparse = 0;
+ 	struct file_buffer *fragment_buffer = NULL;
+ 
++	// 4k align the start of each file.
++	if(do_4k_align)
++		ALIGN_UP(bytes, 4096);
++
+ 	if(pre_duplicate(read_size))
+ 		return write_file_blocks_dup(inode, dir_ent, read_buffer, dup);
+ 
+@@ -4972,6 +4984,7 @@ void write_filesystem_tables(struct squashfs_super_block *sBlk, int nopad)
+ 		"compressed", no_fragments ? "no" : noF ? "uncompressed" :
+ 		"compressed", no_xattrs ? "no" : noX ? "uncompressed" :
+ 		"compressed", noI || noId ? "uncompressed" : "compressed");
++	printf("\t4k %saligned\n", do_4k_align ? "" : "un");
+ 	printf("\tduplicates are %sremoved\n", duplicate_checking ? "" :
+ 		"not ");
+ 	printf("Filesystem size %.2f Kbytes (%.2f Mbytes)\n", bytes / 1024.0,
+@@ -5853,6 +5866,8 @@ print_compressor_options:
+ 			root_name = argv[i];
+ 		} else if(strcmp(argv[i], "-version") == 0) {
+ 			VERSION();
++		} else if(strcmp(argv[i], "-4k-align") == 0) {
++			do_4k_align = TRUE;
+ 		} else {
+ 			ERROR("%s: invalid option\n\n", argv[0]);
+ printOptions:
+@@ -5904,6 +5919,7 @@ printOptions:
+ 			ERROR("\t\t\tdirectory containing that directory, "
+ 				"rather than the\n");
+ 			ERROR("\t\t\tcontents of the directory\n");
++			ERROR("-4k-align\t\tenables 4k alignment of all files\n");
+ 			ERROR("\nFilesystem filter options:\n");
+ 			ERROR("-p <pseudo-definition>\tAdd pseudo file "
+ 				"definition\n");
+-- 
+2.23.0
+
diff --git a/nixpkgs/pkgs/tools/filesystems/squashfs/darwin.patch b/nixpkgs/pkgs/tools/filesystems/squashfs/darwin.patch
new file mode 100644
index 000000000000..eb2dc24ec1a8
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/squashfs/darwin.patch
@@ -0,0 +1,357 @@
+Patch based on commits by Dave Vasilevsky <dave@vasilevsky.ca> and
+Blake Riley <blake.riley@gmail.com>, squashed into a single patch,
+with BSD-specific changes omitted.
+
+See also https://github.com/plougher/squashfs-tools/pull/69.
+
+diff --git a/squashfs-tools/action.c b/squashfs-tools/action.c
+index 4b06ccb..3cad2ab 100644
+--- a/squashfs-tools/action.c
++++ b/squashfs-tools/action.c
+@@ -38,6 +38,10 @@
+ #include <limits.h>
+ #include <errno.h>
+ 
++#ifndef FNM_EXTMATCH /* glibc extension */
++	#define FNM_EXTMATCH 0
++#endif
++
+ #include "squashfs_fs.h"
+ #include "mksquashfs.h"
+ #include "action.h"
+@@ -2284,9 +2288,12 @@ static char *get_start(char *s, int n)
+ 
+ static int subpathname_fn(struct atom *atom, struct action_data *action_data)
+ {
+-	return fnmatch(atom->argv[0], get_start(strdupa(action_data->subpath),
++	char *path = strdup(action_data->subpath);
++	int is_match = fnmatch(atom->argv[0], get_start(path,
+ 		count_components(atom->argv[0])),
+ 		FNM_PATHNAME|FNM_PERIOD|FNM_EXTMATCH) == 0;
++	free(path);
++	return is_match;
+ }
+ 
+ /*
+diff --git a/squashfs-tools/info.c b/squashfs-tools/info.c
+index fe23d78..5c2f835 100644
+--- a/squashfs-tools/info.c
++++ b/squashfs-tools/info.c
+@@ -144,31 +144,22 @@ void dump_state()
+ void *info_thrd(void *arg)
+ {
+ 	sigset_t sigmask;
+-	struct timespec timespec = { .tv_sec = 1, .tv_nsec = 0 };
+-	int sig, waiting = 0;
++	int sig, err, waiting = 0;
+ 
+ 	sigemptyset(&sigmask);
+ 	sigaddset(&sigmask, SIGQUIT);
+ 	sigaddset(&sigmask, SIGHUP);
++	sigaddset(&sigmask, SIGALRM);
+ 
+ 	while(1) {
+-		if(waiting)
+-			sig = sigtimedwait(&sigmask, NULL, &timespec);
+-		else
+-			sig = sigwaitinfo(&sigmask, NULL);
++		err = sigwait(&sigmask, &sig);
+ 
+-		if(sig == -1) {
++		if(err == -1) {
+ 			switch(errno) {
+-			case EAGAIN:
+-				/* interval timed out */
+-				waiting = 0;
+-				/* FALLTHROUGH */
+ 			case EINTR:
+-				/* if waiting, the wait will be longer, but
+-				   that's OK */
+ 				continue;
+ 			default:
+-				BAD_ERROR("sigtimedwait/sigwaitinfo failed "
++				BAD_ERROR("sigwait failed "
+ 					"because %s\n", strerror(errno));
+ 			}
+ 		}
+@@ -179,8 +170,12 @@ void *info_thrd(void *arg)
+ 			/* set one second interval period, if ^\ received
+ 			   within then, dump queue and cache status */
+ 			waiting = 1;
+-		} else
++			alarm(1);
++		} else if (sig == SIGQUIT) {
+ 			dump_state();
++		} else if (sig == SIGALRM) {
++			waiting = 0;
++		}
+ 	}
+ }
+ 
+diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c
+index a45b77f..3607448 100644
+--- a/squashfs-tools/mksquashfs.c
++++ b/squashfs-tools/mksquashfs.c
+@@ -35,7 +35,12 @@
+ #include <stddef.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
++#ifndef linux
++#include <sys/sysctl.h>
++#else
++#include <sys/sysinfo.h>
+ #include <sys/sysmacros.h>
++#endif
+ #include <fcntl.h>
+ #include <errno.h>
+ #include <dirent.h>
+@@ -50,7 +55,10 @@
+ #include <sys/wait.h>
+ #include <limits.h>
+ #include <ctype.h>
+-#include <sys/sysinfo.h>
++
++#ifndef FNM_EXTMATCH /* glibc extension */
++	#define FNM_EXTMATCH 0
++#endif
+ 
+ #ifndef linux
+ #define __BYTE_ORDER BYTE_ORDER
+@@ -4348,6 +4356,7 @@ void initialise_threads(int readq, int fragq, int bwriteq, int fwriteq,
+ 	sigemptyset(&sigmask);
+ 	sigaddset(&sigmask, SIGQUIT);
+ 	sigaddset(&sigmask, SIGHUP);
++	sigaddset(&sigmask, SIGALRM);
+ 	if(pthread_sigmask(SIG_BLOCK, &sigmask, NULL) != 0)
+ 		BAD_ERROR("Failed to set signal mask in intialise_threads\n");
+ 
+@@ -5195,6 +5204,35 @@ int get_physical_memory()
+ 	long long page_size = sysconf(_SC_PAGESIZE);
+ 	int phys_mem;
+ 
++#ifndef linux
++	#ifdef HW_MEMSIZE
++		#define SYSCTL_PHYSMEM HW_MEMSIZE
++	#elif defined(HW_PHYSMEM64)
++		#define SYSCTL_PHYSMEM HW_PHYSMEM64
++	#else
++		#define SYSCTL_PHYSMEM HW_PHYSMEM
++	#endif
++
++	int mib[2];
++	uint64_t sysctl_physmem = 0;
++	size_t sysctl_len = sizeof(sysctl_physmem);
++
++	mib[0] = CTL_HW;
++	mib[1] = SYSCTL_PHYSMEM;
++
++	if(sysctl(mib, 2, &sysctl_physmem, &sysctl_len, NULL, 0) == 0) {
++		/* some systems use 32-bit values, work with what we're given */
++		if (sysctl_len == 4)
++			sysctl_physmem = *(uint32_t*)&sysctl_physmem;
++		phys_mem = sysctl_physmem >> 20;
++	} else {
++		ERROR_START("Failed to get amount of available "
++			"memory.");
++		ERROR_EXIT("  Defaulting to least viable amount\n");
++		phys_mem = SQUASHFS_LOWMEM;
++	}
++  #undef SYSCTL_PHYSMEM
++#else
+ 	if(num_pages == -1 || page_size == -1) {
+ 		struct sysinfo sys;
+ 		int res = sysinfo(&sys);
+@@ -5207,6 +5245,7 @@ int get_physical_memory()
+ 	}
+ 
+ 	phys_mem = num_pages * page_size >> 20;
++#endif
+ 
+ 	if(phys_mem < SQUASHFS_LOWMEM)
+ 		BAD_ERROR("Mksquashfs requires more physical memory than is "
+diff --git a/squashfs-tools/read_xattrs.c b/squashfs-tools/read_xattrs.c
+index 4debedf..3257c30 100644
+--- a/squashfs-tools/read_xattrs.c
++++ b/squashfs-tools/read_xattrs.c
+@@ -39,13 +39,13 @@
+ #include <endian.h>
+ #endif
+ 
++#include <stdlib.h>
++
+ #include "squashfs_fs.h"
+ #include "squashfs_swap.h"
+ #include "xattr.h"
+ #include "error.h"
+ 
+-#include <stdlib.h>
+-
+ extern int read_fs_bytes(int, long long, int, void *);
+ extern int read_block(int, long long, long long *, int, void *);
+ 
+diff --git a/squashfs-tools/unsquashfs.c b/squashfs-tools/unsquashfs.c
+index 727f1d5..c1a6183 100644
+--- a/squashfs-tools/unsquashfs.c
++++ b/squashfs-tools/unsquashfs.c
+@@ -32,8 +32,12 @@
+ #include "stdarg.h"
+ #include "fnmatch_compat.h"
+ 
++#ifndef linux
++#include <sys/sysctl.h>
++#else
+ #include <sys/sysinfo.h>
+ #include <sys/sysmacros.h>
++#endif
+ #include <sys/types.h>
+ #include <sys/time.h>
+ #include <sys/resource.h>
+@@ -1080,7 +1084,7 @@ int create_inode(char *pathname, struct inode *i)
+ 			break;
+ 		case SQUASHFS_SYMLINK_TYPE:
+ 		case SQUASHFS_LSYMLINK_TYPE: {
+-			struct timespec times[2] = {
++			struct timeval times[2] = {
+ 				{ i->time, 0 },
+ 				{ i->time, 0 }
+ 			};
+@@ -1099,8 +1103,7 @@ int create_inode(char *pathname, struct inode *i)
+ 				goto failed;
+ 			}
+ 
+-			res = utimensat(AT_FDCWD, pathname, times,
+-					AT_SYMLINK_NOFOLLOW);
++			res = lutimes(pathname, times);
+ 			if(res == -1) {
+ 				EXIT_UNSQUASH_STRICT("create_inode: failed to set time on "
+ 					"%s, because %s\n", pathname,
+@@ -2235,6 +2238,7 @@ void initialise_threads(int fragment_buffer_size, int data_buffer_size)
+ 	sigemptyset(&sigmask);
+ 	sigaddset(&sigmask, SIGQUIT);
+ 	sigaddset(&sigmask, SIGHUP);
++	sigaddset(&sigmask, SIGALRM);
+ 	if(pthread_sigmask(SIG_BLOCK, &sigmask, NULL) != 0)
+ 		EXIT_UNSQUASH("Failed to set signal mask in initialise_threads"
+ 			"\n");
+diff --git a/squashfs-tools/unsquashfs.h b/squashfs-tools/unsquashfs.h
+index 934618b..0e680ab 100644
+--- a/squashfs-tools/unsquashfs.h
++++ b/squashfs-tools/unsquashfs.h
+@@ -46,6 +46,10 @@
+ #include <sys/ioctl.h>
+ #include <sys/time.h>
+ 
++#ifndef FNM_EXTMATCH /* glibc extension */
++	#define FNM_EXTMATCH 0
++#endif
++
+ #ifndef linux
+ #define __BYTE_ORDER BYTE_ORDER
+ #define __BIG_ENDIAN BIG_ENDIAN
+diff --git a/squashfs-tools/unsquashfs_info.c b/squashfs-tools/unsquashfs_info.c
+index c8e2b9b..7d4f7af 100644
+--- a/squashfs-tools/unsquashfs_info.c
++++ b/squashfs-tools/unsquashfs_info.c
+@@ -97,31 +97,22 @@ void dump_state()
+ void *info_thrd(void *arg)
+ {
+ 	sigset_t sigmask;
+-	struct timespec timespec = { .tv_sec = 1, .tv_nsec = 0 };
+-	int sig, waiting = 0;
++	int sig, err, waiting = 0;
+ 
+ 	sigemptyset(&sigmask);
+ 	sigaddset(&sigmask, SIGQUIT);
+ 	sigaddset(&sigmask, SIGHUP);
++	sigaddset(&sigmask, SIGALRM);
+ 
+ 	while(1) {
+-		if(waiting)
+-			sig = sigtimedwait(&sigmask, NULL, &timespec);
+-		else
+-			sig = sigwaitinfo(&sigmask, NULL);
++		err = sigwait(&sigmask, &sig);
+ 
+-		if(sig == -1) {
++		if(err == -1) {
+ 			switch(errno) {
+-			case EAGAIN:
+-				/* interval timed out */
+-				waiting = 0;
+-				/* FALLTHROUGH */
+ 			case EINTR:
+-				/* if waiting, the wait will be longer, but
+-				   that's OK */
+ 				continue;
+ 			default:
+-				BAD_ERROR("sigtimedwait/sigwaitinfo failed "
++				BAD_ERROR("sigwait failed "
+ 					"because %s\n", strerror(errno));
+ 			}
+ 		}
+@@ -133,8 +124,12 @@ void *info_thrd(void *arg)
+ 			/* set one second interval period, if ^\ received
+ 			   within then, dump queue and cache status */
+ 			waiting = 1;
+-		} else
++			alarm(1);
++		} else if (sig == SIGQUIT) {
+ 			dump_state();
++		} else if (sig == SIGALRM) {
++			waiting = 0;
++		}
+ 	}
+ }
+ 
+diff --git a/squashfs-tools/unsquashfs_xattr.c b/squashfs-tools/unsquashfs_xattr.c
+index 7742dfe..f8cd3b6 100644
+--- a/squashfs-tools/unsquashfs_xattr.c
++++ b/squashfs-tools/unsquashfs_xattr.c
+@@ -27,6 +27,11 @@
+ 
+ #include <sys/xattr.h>
+ 
++#ifdef XATTR_NOFOLLOW /* Apple's xattrs */
++	#define lsetxattr(path_, name_, val_, sz_, flags_) \
++		setxattr(path_, name_, val_, sz_, 0, flags_ | XATTR_NOFOLLOW)
++#endif
++
+ #define NOSPACE_MAX 10
+ 
+ extern int root_process;
+diff --git a/squashfs-tools/xattr.c b/squashfs-tools/xattr.c
+index 64dfd82..d82d186 100644
+--- a/squashfs-tools/xattr.c
++++ b/squashfs-tools/xattr.c
+@@ -22,6 +22,14 @@
+  * xattr.c
+  */
+ 
++#ifndef linux
++#define __BYTE_ORDER BYTE_ORDER
++#define __BIG_ENDIAN BIG_ENDIAN
++#define __LITTLE_ENDIAN LITTLE_ENDIAN
++#else
++#include <endian.h>
++#endif
++
+ #define TRUE 1
+ #define FALSE 0
+ 
+@@ -36,6 +44,13 @@
+ #include <stdlib.h>
+ #include <sys/xattr.h>
+ 
++#ifdef XATTR_NOFOLLOW /* Apple's xattrs */
++	#define llistxattr(path_, buf_, sz_) \
++		listxattr(path_, buf_, sz_, XATTR_NOFOLLOW)
++	#define lgetxattr(path_, name_, val_, sz_) \
++		getxattr(path_, name_, val_, sz_, 0, XATTR_NOFOLLOW)
++#endif
++
+ #include "squashfs_fs.h"
+ #include "squashfs_swap.h"
+ #include "mksquashfs.h"
+-- 
+2.23.0
+
diff --git a/nixpkgs/pkgs/tools/filesystems/squashfs/default.nix b/nixpkgs/pkgs/tools/filesystems/squashfs/default.nix
new file mode 100644
index 000000000000..c833cfe10ada
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/squashfs/default.nix
@@ -0,0 +1,39 @@
+{ lib, stdenv, fetchFromGitHub, zlib, xz
+, lz4
+, zstd
+}:
+
+stdenv.mkDerivation {
+  pname = "squashfs";
+  version = "4.4";
+
+  src = fetchFromGitHub {
+    owner = "plougher";
+    repo = "squashfs-tools";
+    sha256 = "0697fv8n6739mcyn57jclzwwbbqwpvjdfkv1qh9s56lvyqnplwaw";
+    # Tag "4.4" points to this commit.
+    rev = "52eb4c279cd283ed9802dd1ceb686560b22ffb67";
+  };
+
+  patches = [
+    # This patch adds an option to pad filesystems (increasing size) in
+    # exchange for better chunking / binary diff calculation.
+    ./4k-align.patch
+  ] ++ lib.optional stdenv.isDarwin ./darwin.patch;
+
+  buildInputs = [ zlib xz zstd lz4 ];
+
+  preBuild = "cd squashfs-tools";
+
+  installFlags = [ "INSTALL_DIR=\${out}/bin" ];
+
+  makeFlags = [ "XZ_SUPPORT=1" "ZSTD_SUPPORT=1" "LZ4_SUPPORT=1" ];
+
+  meta = {
+    homepage = "http://squashfs.sourceforge.net/";
+    description = "Tool for creating and unpacking squashfs filesystems";
+    platforms = lib.platforms.unix;
+    license = lib.licenses.gpl2Plus;
+    maintainers = with lib.maintainers; [ ruuda ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/squashfuse/default.nix b/nixpkgs/pkgs/tools/filesystems/squashfuse/default.nix
new file mode 100644
index 000000000000..a2e930f9155b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/squashfuse/default.nix
@@ -0,0 +1,32 @@
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, libtool, fuse,
+  pkg-config, lz4, xz, zlib, lzo, zstd }:
+
+with lib;
+
+stdenv.mkDerivation rec {
+
+  pname = "squashfuse";
+  version = "0.1.103";
+
+  # platforms.darwin should be supported : see PLATFORMS file in src.
+  # we could use a nix fuseProvider, and let the derivation choose the OS
+  # specific implementation.
+
+  src = fetchFromGitHub {
+    owner = "vasi";
+    repo  = pname;
+    rev = "540204955134eee44201d50132a5f66a246bcfaf";
+    sha256 = "062s77y32p80vc24a79z31g90b9wxzvws1xvicgx5fn1pd0xa0q6";
+  };
+
+  nativeBuildInputs = [ autoreconfHook libtool pkg-config ];
+  buildInputs = [ lz4 xz zlib lzo zstd fuse ];
+
+  meta = {
+    description = "FUSE filesystem to mount squashfs archives";
+    homepage = "https://github.com/vasi/squashfuse";
+    maintainers = [  ];
+    platforms = platforms.linux;
+    license = "BSD-2-Clause";
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/sshfs-fuse/default.nix b/nixpkgs/pkgs/tools/filesystems/sshfs-fuse/default.nix
new file mode 100644
index 000000000000..69826941d00f
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/sshfs-fuse/default.nix
@@ -0,0 +1,52 @@
+{ lib, stdenv, fetchFromGitHub
+, meson, pkg-config, ninja, docutils, makeWrapper
+, fuse3, glib
+, which, python3Packages
+, openssh
+}:
+
+stdenv.mkDerivation rec {
+  version = "3.7.1";
+  pname = "sshfs-fuse";
+
+  src = fetchFromGitHub {
+    owner = "libfuse";
+    repo = "sshfs";
+    rev = "sshfs-${version}";
+    sha256 = "088mgcsqv9f2vly4xn6lvvkmqkgr9jjmjs9qp8938hl7j6rrgd17";
+  };
+
+  nativeBuildInputs = [ meson pkg-config ninja docutils makeWrapper ];
+  buildInputs = [ fuse3 glib ];
+  checkInputs = [ which python3Packages.pytest ];
+
+  NIX_CFLAGS_COMPILE = lib.optionalString
+    (stdenv.hostPlatform.system == "i686-linux")
+    "-D_FILE_OFFSET_BITS=64";
+
+  postInstall = ''
+    mkdir -p $out/sbin
+    ln -sf $out/bin/sshfs $out/sbin/mount.sshfs
+    wrapProgram $out/bin/sshfs --prefix PATH : "${openssh}/bin"
+  '';
+
+  #doCheck = true;
+  checkPhase = ''
+    # The tests need fusermount:
+    mkdir bin && cp ${fuse3}/bin/fusermount3 bin/fusermount
+    export PATH=bin:$PATH
+    # Can't access /dev/fuse within the sandbox: "FUSE kernel module does not seem to be loaded"
+    substituteInPlace test/util.py --replace "/dev/fuse" "/dev/null"
+    # TODO: "fusermount executable not setuid, and we are not root"
+    # We should probably use a VM test instead
+    python3 -m pytest test/
+  '';
+
+  meta = with lib; {
+    inherit (src.meta) homepage;
+    description = "FUSE-based filesystem that allows remote filesystems to be mounted over SSH";
+    platforms = platforms.linux;
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ primeos ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/svnfs/default.nix b/nixpkgs/pkgs/tools/filesystems/svnfs/default.nix
new file mode 100644
index 000000000000..bef4d6b5cea1
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/svnfs/default.nix
@@ -0,0 +1,28 @@
+{ lib, stdenv, fetchurl, automake, autoconf, subversion, fuse, apr, perl }:
+
+stdenv.mkDerivation {
+  name = "svnfs-0.4";
+
+  src = fetchurl {
+    url = "http://www.jmadden.eu/wp-content/uploads/svnfs/svnfs-0.4.tgz";
+    sha256 = "1lrzjr0812lrnkkwk60bws9k1hq2iibphm0nhqyv26axdsygkfky";
+  };
+
+  buildInputs = [automake autoconf subversion fuse apr perl];
+
+  # why is this required?
+  preConfigure=''
+    export LD_LIBRARY_PATH=${subversion.out}/lib
+  '';
+
+  NIX_CFLAGS_COMPILE="-I ${subversion.dev}/include/subversion-1";
+  NIX_LDFLAGS="-lsvn_client-1 -lsvn_subr-1";
+
+  meta = {
+    description = "FUSE filesystem for accessing Subversion repositories";
+    homepage = "http://www.jmadden.eu/index.php/svnfs/";
+    license = lib.licenses.gpl2;
+    maintainers = [lib.maintainers.marcweber];
+    platforms = lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/tmsu/default.nix b/nixpkgs/pkgs/tools/filesystems/tmsu/default.nix
new file mode 100644
index 000000000000..7129de950136
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/tmsu/default.nix
@@ -0,0 +1,40 @@
+{ lib, stdenv, buildGoPackage, fetchFromGitHub, fuse, installShellFiles }:
+
+buildGoPackage rec {
+  pname = "tmsu";
+  version = "0.7.5";
+  goPackagePath = "github.com/oniony/TMSU";
+
+  src = fetchFromGitHub {
+    owner = "oniony";
+    repo = "tmsu";
+    rev = "v${version}";
+    sha256 = "0834hah7p6ad81w60ifnxyh9zn09ddfgrll04kwjxwp7ypbv38wq";
+  };
+
+  goDeps = ./deps.nix;
+
+  buildInputs = [ fuse ];
+  nativeBuildInputs = [ installShellFiles ];
+
+  preBuild = ''
+    mv go/src/${goPackagePath} src
+    mv src/src/${goPackagePath} go/src/${goPackagePath}
+    export GOPATH=$PWD:$GOPATH
+  '';
+
+  postInstall = ''
+    mv $out/bin/{TMSU,tmsu}
+    cp src/misc/bin/* $out/bin/
+    installManPage src/misc/man/tmsu.1
+    installShellCompletion --zsh src/misc/zsh/_tmsu
+  '';
+
+  meta = with lib; {
+    homepage    = "http://www.tmsu.org";
+    description = "A tool for tagging your files using a virtual filesystem";
+    maintainers = with maintainers; [ pSub ];
+    license     = licenses.gpl3;
+    platforms   = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/tmsu/deps.nix b/nixpkgs/pkgs/tools/filesystems/tmsu/deps.nix
new file mode 100644
index 000000000000..90e64b434c4a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/tmsu/deps.nix
@@ -0,0 +1,39 @@
+# This file was generated by https://github.com/kamilchm/go2nix v1.3.0
+[
+  {
+    goPackagePath = "github.com/hanwen/go-fuse";
+    fetch = {
+      type = "git";
+      url = "https://github.com/hanwen/go-fuse";
+      rev = "730713460d4fc41afdc2533bd37ff60c94c0c586";
+      sha256 = "1y44d08fxyis99s6jxdr6dbbw5kv3wb8lkhq3xmr886i4w41lz03";
+    };
+  }
+  {
+    goPackagePath = "github.com/mattn/go-sqlite3";
+    fetch = {
+      type = "git";
+      url = "https://github.com/mattn/go-sqlite3";
+      rev = "98a44bcf5949f178c8116fa30e62c9ac2ef65927";
+      sha256 = "108rk74ringkkyx05zlq5khh32fsfi0przyzrpsr1r5j57xrhxj0";
+    };
+  }
+  {
+    goPackagePath = "golang.org/x/crypto";
+    fetch = {
+      type = "git";
+      url = "https://go.googlesource.com/crypto";
+      rev = "3c4aac89819a5fdc28d906456729d3423fd46969";
+      sha256 = "16q9ay6bl28zrnb377p8lvrs2nd98h7i6y3yi8ccjwzg1czbfdsi";
+    };
+  }
+  {
+    goPackagePath = "golang.org/x/sys";
+    fetch = {
+      type = "git";
+      url = "https://go.googlesource.com/sys";
+      rev = "1957bb5e6d1f523308b49060df02171d06ddfc77";
+      sha256 = "0imqk4l9785rw7ddvywyf8zn7k3ga6f17ky8rmf8wrri7nknr03f";
+    };
+  }
+]
diff --git a/nixpkgs/pkgs/tools/filesystems/u3-tool/default.nix b/nixpkgs/pkgs/tools/filesystems/u3-tool/default.nix
new file mode 100644
index 000000000000..6abab83b0fd0
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/u3-tool/default.nix
@@ -0,0 +1,21 @@
+{ lib, stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  pname = "u3-tool";
+  version = "0.3";
+
+  enableParallelBuilding = true;
+
+  src = fetchurl {
+    url = "mirror://sourceforge/${pname}/${pname}-${version}.tar.gz";
+    sha256 = "1p9c9kibd1pdbdfa0nd0i3n7bvzi3xg0chm38jg3xfl8gsn0390f";
+  };
+
+  meta = with lib; {
+    description = "Tool for controlling the special features of a 'U3 smart drive' USB Flash disk";
+    homepage = "https://sourceforge.net/projects/u3-tool/";
+    license = licenses.gpl2;
+    platforms = with platforms; linux;
+    maintainers = with maintainers; [ makefu ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/ubidump/default.nix b/nixpkgs/pkgs/tools/filesystems/ubidump/default.nix
new file mode 100644
index 000000000000..2787b87964fd
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/ubidump/default.nix
@@ -0,0 +1,40 @@
+{ lib, stdenv, fetchFromGitHub, python3, makeWrapper }:
+
+python3.pkgs.buildPythonApplication rec {
+
+  pname = "ubidump";
+  version = "unstable-2019-09-11";
+
+  src = fetchFromGitHub {
+    owner = "nlitsme";
+    repo = pname;
+    rev = "0691f1a9a38604c2baf8c9af6b826eb2632af74a";
+    sha256 = "1hiivlgni4r3nd5n2rzl5qzw6y2wpjpmyls5lybrc8imd6rmj3w2";
+  };
+
+  propagatedBuildInputs = with python3.pkgs; [ crcmod python-lzo ];
+
+  phases = [ "unpackPhase" "patchPhase" "installPhase" "installCheckPhase" ];
+
+  patchPhase = ''
+    sed -i '1s;^;#!${python3.interpreter}\n;' ubidump.py
+    patchShebangs ubidump.py
+  '';
+
+  installPhase = ''
+    install -D -m755 ubidump.py $out/bin/ubidump
+    wrapProgram $out/bin/ubidump --set PYTHONPATH $PYTHONPATH
+  '';
+
+  installCheckPhase = ''
+    $out/bin/ubidump -h  > /dev/null
+  '';
+
+  meta = with lib; {
+    description = "View or extract the contents of UBIFS images";
+    homepage = "https://github.com/nlitsme/ubidump";
+    license = licenses.mit;
+    maintainers = with maintainers; [ sgo ];
+  };
+}
+
diff --git a/nixpkgs/pkgs/tools/filesystems/udftools/default.nix b/nixpkgs/pkgs/tools/filesystems/udftools/default.nix
new file mode 100644
index 000000000000..ec3fd6efefae
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/udftools/default.nix
@@ -0,0 +1,42 @@
+{ lib, stdenv, fetchFromGitHub, ncurses, readline, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  pname = "udftools";
+  version = "2.0";
+  src = fetchFromGitHub {
+    owner = "pali";
+    repo = "udftools";
+    rev = version;
+    sha256 = "0mz04h3rki6ljwfs15z83gf4vv816w7xgz923waiqgmfj9xpvx87";
+  };
+
+  buildInputs = [ ncurses readline ];
+  nativeBuildInputs = [ autoreconfHook ];
+
+  hardeningDisable = [ "fortify" ];
+
+  NIX_CFLAGS_COMPILE = "-std=gnu90";
+
+  preConfigure = ''
+    sed -e '1i#include <limits.h>' -i cdrwtool/cdrwtool.c -i pktsetup/pktsetup.c
+    sed -e 's@[(]char[*][)]spm [+]=@spm = ((char*) spm) + @' -i wrudf/wrudf.c
+    sed -e '27i#include <string.h>' -i include/udf_endian.h
+    sed -e '38i#include <string.h>' -i wrudf/wrudf-cdrw.c
+    sed -e '12i#include <string.h>' -i wrudf/wrudf-cdr.c
+    sed -e '37i#include <stdlib.h>' -i wrudf/ide-pc.c
+    sed -e '46i#include <sys/sysmacros.h>' -i mkudffs/main.c
+
+    sed -e "s@\$(DESTDIR)/lib/udev/rules.d@$out/lib/udev/rules.d@" -i pktsetup/Makefile.am
+  '';
+
+  postFixup = ''
+    sed -i -e "s@/usr/sbin/pktsetup@$out/sbin/pktsetup@" $out/lib/udev/rules.d/80-pktsetup.rules
+  '';
+
+  meta = with lib; {
+    description = "UDF tools";
+    maintainers = with maintainers; [ raskin ];
+    platforms = platforms.linux;
+    license = licenses.gpl2Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/unionfs-fuse/default.nix b/nixpkgs/pkgs/tools/filesystems/unionfs-fuse/default.nix
new file mode 100644
index 000000000000..77f45d06c91c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/unionfs-fuse/default.nix
@@ -0,0 +1,45 @@
+{ lib, stdenv, fetchFromGitHub, cmake, fuse }:
+
+stdenv.mkDerivation rec {
+  pname = "unionfs-fuse";
+  version = "2.1";
+
+  src = fetchFromGitHub {
+    owner = "rpodgorny";
+    repo = "unionfs-fuse";
+    rev = "v${version}";
+    sha256 = "0bwx70x834qgqh53vqp18bhbxbsny80hz922rbgj8k9wj7cbfilm";
+  };
+
+  patches =
+    [ # Prevent the unionfs daemon from being killed during
+      # shutdown. See
+      # http://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons/
+      # for details.
+      ./prevent-kill-on-shutdown.patch
+    ];
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ fuse ];
+
+  # Put the unionfs mount helper in place as mount.unionfs-fuse. This makes it
+  # possible to do:
+  #   mount -t unionfs-fuse none /dest -o dirs=/source1=RW,/source2=RO
+  #
+  # This must be done in preConfigure because the build process removes
+  # helper from the source directory during the build.
+  preConfigure = ''
+    mkdir -p $out/sbin
+    cp -a mount.unionfs $out/sbin/mount.unionfs-fuse
+    substituteInPlace $out/sbin/mount.unionfs-fuse --replace mount.fuse ${fuse}/sbin/mount.fuse
+    substituteInPlace $out/sbin/mount.unionfs-fuse --replace unionfs $out/bin/unionfs
+  '';
+
+  meta = with lib; {
+    description = "FUSE UnionFS implementation";
+    homepage = "https://github.com/rpodgorny/unionfs-fuse";
+    license = licenses.bsd3;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ orivej ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/unionfs-fuse/prevent-kill-on-shutdown.patch b/nixpkgs/pkgs/tools/filesystems/unionfs-fuse/prevent-kill-on-shutdown.patch
new file mode 100644
index 000000000000..0a98b83282b6
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/unionfs-fuse/prevent-kill-on-shutdown.patch
@@ -0,0 +1,14 @@
+diff -ru -x '*~' unionfs-fuse-0.26-orig/src/unionfs.c unionfs-fuse-0.26/src/unionfs.c
+--- unionfs-fuse-0.26-orig/src/unionfs.c	2012-09-11 00:06:32.000000000 +0200
++++ unionfs-fuse-0.26/src/unionfs.c	2014-05-21 14:22:03.597861805 +0200
+@@ -831,6 +831,10 @@
+ 	}
+ #endif
+ 
++	/* Prevent systemd's shutdown from killing us. */
++	if (access("/etc/initrd-release", F_OK) >= 0)
++		argv[0][0] = '@';
++
+ 	umask(0);
+ 	int res = fuse_main(args.argc, args.argv, &unionfs_oper, NULL);
+ 	RETURN(uopt.doexit ? uopt.retval : res);
diff --git a/nixpkgs/pkgs/tools/filesystems/vmfs-tools/default.nix b/nixpkgs/pkgs/tools/filesystems/vmfs-tools/default.nix
new file mode 100644
index 000000000000..b60dccc4e68f
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/vmfs-tools/default.nix
@@ -0,0 +1,39 @@
+{ lib, stdenv
+, fetchFromGitHub
+, pkg-config
+, asciidoc
+, docbook_xsl
+, fuse
+, libuuid
+, libxslt
+}:
+
+stdenv.mkDerivation rec {
+  pname = "vmfs-tools";
+  version = "0.2.5.20160116";
+
+  src = fetchFromGitHub {
+    owner = "glandium";
+    repo = pname;
+    rev = "4ab76ef5b074bdf06e4b518ff6d50439de05ae7f";
+    sha256 = "14y412ww5hxk336ils62s3fwykfh6mx1j0iiaa5cwc615pi6qvi4";
+  };
+
+  nativeBuildInputs = [ asciidoc docbook_xsl libxslt pkg-config ];
+
+  buildInputs = [ fuse libuuid ];
+
+  enableParallelBuilding = true;
+
+  postInstall = ''
+    install -Dm444 -t $out/share/doc/${pname} AUTHORS LICENSE README TODO
+  '';
+
+  meta = with lib; {
+    description = "FUSE-based VMFS (vmware) file system tools";
+    maintainers = with maintainers; [ peterhoeg ];
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+    inherit (src.meta) homepage;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/wdfs/default.nix b/nixpkgs/pkgs/tools/filesystems/wdfs/default.nix
new file mode 100644
index 000000000000..983773657386
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/wdfs/default.nix
@@ -0,0 +1,18 @@
+{lib, stdenv, fetchurl, glib, neon, fuse, pkg-config}:
+
+stdenv.mkDerivation {
+  name = "wdfs-fuse-1.4.2";
+  src = fetchurl {
+    url = "http://noedler.de/projekte/wdfs/wdfs-1.4.2.tar.gz";
+    sha256 = "fcf2e1584568b07c7f3683a983a9be26fae6534b8109e09167e5dff9114ba2e5";
+  };
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [fuse glib neon];
+
+  meta = with lib; {
+    homepage = "http://noedler.de/projekte/wdfs/";
+    license = licenses.gpl2;
+    description = "User-space filesystem that allows to mount a webdav share";
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/wiimms-iso-tools/default.nix b/nixpkgs/pkgs/tools/filesystems/wiimms-iso-tools/default.nix
new file mode 100644
index 000000000000..70c445014098
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/wiimms-iso-tools/default.nix
@@ -0,0 +1,37 @@
+{lib, stdenv, fetchurl, zlib, ncurses, fuse}:
+
+stdenv.mkDerivation rec {
+  name = "wiimms-iso-tools";
+  version = "3.02a";
+
+  src = fetchurl {
+    url = "https://download.wiimm.de/source/wiimms-iso-tools/wiimms-iso-tools.source-${version}.tar.bz2";
+    sha256 = "074cvcaqz23xyihslc6n64wwxwcnl6xp7l0750yb9pc0wrqxmj69";
+  };
+
+  buildInputs = [ zlib ncurses fuse ];
+
+  patches = [ ./fix-paths.diff ];
+  postPatch = ''
+    patchShebangs setup.sh
+    patchShebangs gen-template.sh
+    patchShebangs gen-text-file.sh
+  '';
+
+  NIX_CFLAGS_COMPILE = "-Wno-error=format-security";
+  INSTALL_PATH = "$out";
+
+  installPhase = ''
+    mkdir "$out"
+    patchShebangs install.sh
+    ./install.sh --no-sudo
+  '';
+
+  meta = with lib; {
+    homepage = "https://wit.wiimm.de";
+    description = "A set of command line tools to manipulate Wii and GameCube ISO images and WBFS containers";
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ nilp0inter ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/wiimms-iso-tools/fix-paths.diff b/nixpkgs/pkgs/tools/filesystems/wiimms-iso-tools/fix-paths.diff
new file mode 100644
index 000000000000..4a545e92a185
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/wiimms-iso-tools/fix-paths.diff
@@ -0,0 +1,12 @@
+diff -r -u wiimms-iso-tools.source-3.02a.patched/setup.sh wiimms-iso-tools.source-3.02a/setup.sh
+--- wiimms-iso-tools.source-3.02a.patched/setup.sh	2020-06-02 23:48:18.651495869 +0200
++++ wiimms-iso-tools.source-3.02a/setup.sh	2020-06-02 23:48:29.758162513 +0200
+@@ -57,7 +57,7 @@
+ 
+ #--------------------------------------------------
+ 
+-INSTALL_PATH=/usr/local
++ INSTALL_PATH="$out"
+ 
+ if [[ -d $INSTALL_PATH/bin ]]
+ then
diff --git a/nixpkgs/pkgs/tools/filesystems/xfsprogs/default.nix b/nixpkgs/pkgs/tools/filesystems/xfsprogs/default.nix
new file mode 100644
index 000000000000..009c5e05d5da
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/xfsprogs/default.nix
@@ -0,0 +1,55 @@
+{ lib, stdenv, buildPackages, fetchpatch, fetchurl, autoconf, automake, gettext, libtool, pkg-config
+, icu, libuuid, readline, inih
+}:
+
+stdenv.mkDerivation rec {
+  pname = "xfsprogs";
+  version = "5.10.0";
+
+  src = fetchurl {
+    url = "mirror://kernel/linux/utils/fs/xfs/xfsprogs/${pname}-${version}.tar.xz";
+    sha256 = "1schqzjx836jd54l10pqds7hyli2m77df3snk95xbr23dpj1fh70";
+  };
+
+  outputs = [ "bin" "dev" "out" "doc" ];
+
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [
+    autoconf automake libtool gettext pkg-config
+    libuuid # codegen tool uses libuuid
+  ];
+  buildInputs = [ readline icu inih ];
+  propagatedBuildInputs = [ libuuid ]; # Dev headers include <uuid/uuid.h>
+
+  enableParallelBuilding = true;
+
+  # @sbindir@ is replaced with /run/current-system/sw/bin to fix dependency cycles
+  preConfigure = ''
+    for file in scrub/{xfs_scrub_all.cron.in,xfs_scrub@.service.in,xfs_scrub_all.service.in}; do
+      substituteInPlace "$file" \
+        --replace '@sbindir@' '/run/current-system/sw/bin'
+    done
+    make configure
+    patchShebangs ./install-sh
+  '';
+
+  configureFlags = [
+    "--disable-lib64"
+    "--with-systemd-unit-dir=${placeholder "out"}/lib/systemd/system"
+  ];
+
+  installFlags = [ "install-dev" ];
+
+  # FIXME: forbidden rpath
+  postInstall = ''
+    find . -type d -name .libs | xargs rm -rf
+  '';
+
+  meta = with lib; {
+    homepage = "https://xfs.org/";
+    description = "SGI XFS utilities";
+    license = licenses.lgpl21;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ dezgeg ajs124 ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/xtreemfs/default.nix b/nixpkgs/pkgs/tools/filesystems/xtreemfs/default.nix
new file mode 100644
index 000000000000..d8d414500793
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/xtreemfs/default.nix
@@ -0,0 +1,78 @@
+{ stdenv, boost, fuse, openssl, cmake, attr, jdk, ant, which, file, python
+, lib, valgrind, makeWrapper, fetchFromGitHub, fetchpatch }:
+
+stdenv.mkDerivation {
+  src = fetchFromGitHub {
+    # using unstable release because stable (v1.5.1) has broken repl java plugin
+    rev = "7ddcb081aa125b0cfb008dc98addd260b8353ab3";
+    owner = "xtreemfs";
+    repo = "xtreemfs";
+    sha256 = "1hjmd32pla27zf98ghzz6r5ml8ry86m9dsryv1z01kxv5l95b3m0";
+  };
+
+  pname = "XtreemFS";
+  version = "1.5.1.81";
+
+  buildInputs = [ which attr makeWrapper python ];
+
+  patches = [
+    (fetchpatch {
+      url = "https://github.com/xtreemfs/xtreemfs/commit/ebfdc2fff56c09f310159d92026883941e42a953.patch";
+      sha256 = "075w00ad88qm6xpm5679m0gfzkrc53w17sk7ycybf4hzxjs29ygy";
+      name = "xtreemfs-fix-for-openssl_1_1";
+    })
+  ];
+
+  preConfigure = ''
+    export JAVA_HOME=${jdk}
+    export ANT_HOME=${ant}
+
+    export BOOST_INCLUDEDIR=${boost.dev}/include
+    export BOOST_LIBRARYDIR=${boost.out}/lib
+    export CMAKE_INCLUDE_PATH=${openssl.dev}/include
+    export CMAKE_LIBRARY_PATH=${openssl.out}/lib
+
+    substituteInPlace cpp/cmake/FindValgrind.cmake \
+      --replace "/usr/local" "${valgrind}"
+
+    substituteInPlace cpp/CMakeLists.txt \
+      --replace '"/lib64" "/usr/lib64"' '"${attr.out}/lib" "${fuse}/lib"'
+
+    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${fuse}/include"
+    export NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK -L${fuse}/lib"
+
+    export DESTDIR=$out
+
+    substituteInPlace Makefile \
+      --replace "/usr/share/" "/share/" \
+      --replace 'BIN_DIR=$(DESTDIR)/usr/bin' "BIN_DIR=$out/bin"
+
+    substituteInPlace etc/init.d/generate_initd_scripts.sh \
+      --replace "/bin/bash" "${stdenv.shell}"
+
+    substituteInPlace cpp/thirdparty/gtest-1.7.0/configure \
+      --replace "/usr/bin/file" "${file}/bin/file"
+
+    substituteInPlace cpp/thirdparty/protobuf-2.5.0/configure \
+      --replace "/usr/bin/file" "${file}/bin/file"
+
+    substituteInPlace cpp/thirdparty/protobuf-2.5.0/gtest/configure \
+      --replace "/usr/bin/file" "${file}/bin/file"
+
+    # do not put cmake into buildInputs
+    export PATH="$PATH:${cmake}/bin"
+  '';
+
+  doCheck = false;
+
+  postInstall = ''
+    rm -r $out/sbin
+  '';
+
+  meta = {
+    description = "A distributed filesystem";
+    maintainers = with lib.maintainers; [ raskin matejc ];
+    platforms = lib.platforms.linux;
+    license = lib.licenses.bsd3;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/yandex-disk/default.nix b/nixpkgs/pkgs/tools/filesystems/yandex-disk/default.nix
new file mode 100644
index 000000000000..d2779e2b4c59
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/yandex-disk/default.nix
@@ -0,0 +1,65 @@
+{ lib, stdenv, fetchurl, writeText, zlib, rpmextract, patchelf, which }:
+
+let
+  p = if stdenv.is64bit then {
+      arch = "x86_64";
+      gcclib = "${stdenv.cc.cc.lib}/lib64";
+      sha256 = "14bpc5ddhxvgfxkxhj5q9z443s7z4nn1zf4k1hxj7rbf13rcpg00";
+    }
+    else {
+      arch = "i386";
+      gcclib = "${stdenv.cc.cc.lib}/lib";
+      sha256 = "1s829q8gy9xgz0jm7w70aljqs2h49x402blqfr9zvn806aprmrm5";
+    };
+in
+stdenv.mkDerivation rec {
+
+  pname = "yandex-disk";
+  version = "0.1.5.1039";
+
+  src = fetchurl {
+    url = "https://repo.yandex.ru/yandex-disk/rpm/stable/${p.arch}/${pname}-${version}-1.fedora.${p.arch}.rpm";
+    sha256 = p.sha256;
+  };
+
+  builder = writeText "builder.sh" ''
+    . $stdenv/setup
+    mkdir -pv $out/bin
+    mkdir -pv $out/share
+    mkdir -pv $out/etc
+
+    mkdir -pv unpacked
+    cd unpacked
+    ${rpmextract}/bin/rpmextract $src
+
+    mkdir -p $out/share/bash-completion/completions
+    cp -r -t $out/bin usr/bin/*
+    cp -r -t $out/share usr/share/*
+    cp -r -t $out/share/bash-completion/completions etc/bash_completion.d/*
+
+    sed -i 's@have@${which}/bin/which >/dev/null 2>\&1@' \
+      $out/share/bash-completion/completions/yandex-disk-completion.bash
+
+    ${patchelf}/bin/patchelf \
+      --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
+      --set-rpath "${zlib.out}/lib:${p.gcclib}" \
+      $out/bin/yandex-disk
+  '';
+
+  meta = {
+    homepage = "https://help.yandex.com/disk/cli-clients.xml";
+    description = "A free cloud file storage service";
+    maintainers = with lib.maintainers; [ smironov jagajaga ];
+    platforms = ["i686-linux" "x86_64-linux"];
+    license = lib.licenses.unfree;
+    longDescription = ''
+      Yandex.Disk console client for Linux lets you manage files on Disk without
+      using a window interface or programs that support WebDAV. The advantages
+      of the console client compared to a WebDAV connection:
+       * low system resource requirements;
+       * faster file reading and writing speeds;
+       * faster syncing with Disk's server;
+       * no need to be constantly connected to work with files.
+    '';
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/zerofree/default.nix b/nixpkgs/pkgs/tools/filesystems/zerofree/default.nix
new file mode 100644
index 000000000000..2489357f73f9
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/zerofree/default.nix
@@ -0,0 +1,26 @@
+{ lib, stdenv, fetchurl, e2fsprogs }:
+
+stdenv.mkDerivation rec {
+  pname = "zerofree";
+  version = "1.1.1";
+
+  src = fetchurl {
+    url = "https://frippery.org/uml/${pname}-${version}.tgz";
+    sha256 = "0rrqfa5z103ws89vi8kfvbks1cfs74ix6n1wb6vs582vnmhwhswm";
+  };
+
+  buildInputs = [ e2fsprogs ];
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp zerofree $out/bin
+'';
+
+  meta = {
+    homepage = "https://frippery.org/uml/";
+    description = "Zero free blocks from ext2, ext3 and ext4 file-systems";
+    platforms = lib.platforms.linux;
+    license = lib.licenses.gpl2;
+    maintainers = [ lib.maintainers.theuni ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/zfstools/default.nix b/nixpkgs/pkgs/tools/filesystems/zfstools/default.nix
new file mode 100644
index 000000000000..ecc4b1184867
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/zfstools/default.nix
@@ -0,0 +1,41 @@
+{ lib, stdenv, fetchFromGitHub, ruby, zfs }:
+
+let version = "0.3.6"; in
+stdenv.mkDerivation rec {
+  pname = "zfstools";
+  inherit version;
+
+  src = fetchFromGitHub {
+    sha256 = "16lvw3xbmxp2pr8nixqn7lf4504zaaxvbbdnjkv4dggwd4lsdjyg";
+    rev = "v${version}";
+    repo = "zfstools";
+    owner = "bdrewery";
+  };
+
+  buildInputs = [ ruby ];
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp bin/* $out/bin/
+
+    cp -R lib $out/
+
+    for f in $out/bin/*; do
+      substituteInPlace $f --replace "/usr/bin/env ruby" "ruby -I$out/lib"
+    done
+
+    sed -e 's|cmd.*=.*"zfs |cmd = "${zfs}/sbin/zfs |g' -i $out/lib/zfstools/{dataset,snapshot}.rb
+  '';
+
+  meta = with lib; {
+    inherit version;
+    inherit (src.meta) homepage;
+    description = "OpenSolaris-compatible auto-snapshotting script for ZFS";
+    longDescription = ''
+      zfstools is an OpenSolaris-like and compatible auto snapshotting script
+      for ZFS, which also supports auto snapshotting mysql databases.
+    '';
+    license = licenses.bsd2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/zkfuse/default.nix b/nixpkgs/pkgs/tools/filesystems/zkfuse/default.nix
new file mode 100644
index 000000000000..456444f3bf59
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/zkfuse/default.nix
@@ -0,0 +1,38 @@
+{ stdenv
+, lib
+, autoreconfHook
+, gnused
+, boost
+, fuse
+, log4cxx
+, zookeeper
+, zookeeper_mt
+}:
+
+stdenv.mkDerivation rec {
+  pname = "zkfuse";
+  inherit (zookeeper_mt) version src;
+
+  sourceRoot = "apache-${zookeeper.pname}-${version}/zookeeper-contrib/zookeeper-contrib-zkfuse";
+
+  nativeBuildInputs = [ autoreconfHook gnused ];
+  buildInputs = [ zookeeper_mt log4cxx boost fuse ];
+
+  postPatch = ''
+    # Make the async API accessible, and use the proper include path.
+    sed -i src/zkadapter.h \
+        -e '/"zookeeper\.h"/i#define THREADED' \
+        -e 's,"zookeeper\.h",<zookeeper/zookeeper.h>,'
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp -v src/zkfuse $out/bin
+  '';
+
+  meta = with lib; {
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ cstrahan ztzg ];
+    license = licenses.asl20;
+  };
+}