about summary refs log tree commit diff
path: root/pkgs/tools/filesystems/unionfs-fuse
diff options
context:
space:
mode:
authorRickard Nilsson <rickynils@gmail.com>2013-04-09 16:36:38 +0200
committerRickard Nilsson <rickynils@gmail.com>2013-04-09 16:36:38 +0200
commit7870db8b10caf0d78d9472531a31e87aa865ab6b (patch)
tree3689661eb549d28539050962b2d01fd39ac6bc0d /pkgs/tools/filesystems/unionfs-fuse
parent08f1b426bc15e07c7b0fc52fd73232d9966dac12 (diff)
downloadnixlib-7870db8b10caf0d78d9472531a31e87aa865ab6b.tar
nixlib-7870db8b10caf0d78d9472531a31e87aa865ab6b.tar.gz
nixlib-7870db8b10caf0d78d9472531a31e87aa865ab6b.tar.bz2
nixlib-7870db8b10caf0d78d9472531a31e87aa865ab6b.tar.lz
nixlib-7870db8b10caf0d78d9472531a31e87aa865ab6b.tar.xz
nixlib-7870db8b10caf0d78d9472531a31e87aa865ab6b.tar.zst
nixlib-7870db8b10caf0d78d9472531a31e87aa865ab6b.zip
unionfs: Add mount helper (mount.unionfs-fuse)
This makes it possible to mount unionfs directly with mount or fstab.

Example fstab entry:

  none /mnt/union unionf-fuse allow-other,dirs=/source1=RW,/source2=RW

Note, the dirs= option need to be the last option, due to limitations
in the mount helper provided by unionfs-fuse. Maybe we should write a
better helper ourselves.

Also, you need to specify your branches as dirs= option, NOT as
the device, since the latest version of libmount always interprets
"=" characters in the device name as a tag (like LABEL, UUID etc)
and will try to resolve the tag before calling the mount helper.
This will of course not succeed and the mount will fail.
Diffstat (limited to 'pkgs/tools/filesystems/unionfs-fuse')
-rw-r--r--pkgs/tools/filesystems/unionfs-fuse/default.nix14
1 files changed, 13 insertions, 1 deletions
diff --git a/pkgs/tools/filesystems/unionfs-fuse/default.nix b/pkgs/tools/filesystems/unionfs-fuse/default.nix
index 43d7a5a8d180..5b681ab170c5 100644
--- a/pkgs/tools/filesystems/unionfs-fuse/default.nix
+++ b/pkgs/tools/filesystems/unionfs-fuse/default.nix
@@ -5,12 +5,24 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "http://podgorny.cz/unionfs-fuse/releases/${name}.tar.xz";
-
     sha256 = "0qpnr4czgc62vsfnmv933w62nq3xwcbnvqch72qakfgca75rsp4d";
   };
 
   buildInputs = [ cmake 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 = ''
+    ensureDir $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 = {
     description = "FUSE UnionFS implementation";
     homepage = http://podgorny.cz/moin/UnionFsFuse;