about summary refs log tree commit diff
path: root/pkgs/tools/filesystems
diff options
context:
space:
mode:
authorKonstantin Alekseev <mail@kalekseev.com>2021-03-07 01:50:29 +0300
committerKonstantin Alekseev <mail@kalekseev.com>2021-03-09 11:58:37 +0300
commit5a49c9599d8bf346a97bb64cd78d5266a4d72ee2 (patch)
tree5824890c00f30b442907f6491d0d4c717495d8a7 /pkgs/tools/filesystems
parentf066807b58d8f655c7df0a22611bba41ed84e969 (diff)
unionfs-fuse: enable darwin
Diffstat (limited to 'pkgs/tools/filesystems')
-rw-r--r--pkgs/tools/filesystems/unionfs-fuse/default.nix29
1 files changed, 18 insertions, 11 deletions
diff --git a/pkgs/tools/filesystems/unionfs-fuse/default.nix b/pkgs/tools/filesystems/unionfs-fuse/default.nix
index 77f45d06c91ca..6af582d91a7b1 100644
--- a/pkgs/tools/filesystems/unionfs-fuse/default.nix
+++ b/pkgs/tools/filesystems/unionfs-fuse/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchFromGitHub, cmake, fuse }:
+{ lib, stdenv, fetchFromGitHub, cmake, fuse, osxfuse }:
 
 stdenv.mkDerivation rec {
   pname = "unionfs-fuse";
@@ -11,16 +11,23 @@ stdenv.mkDerivation rec {
     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
-    ];
+  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
+  ];
+
+  postPatch = lib.optionalString stdenv.isDarwin ''
+    substituteInPlace CMakeLists.txt \
+      --replace '/usr/local/include/osxfuse/fuse' '${osxfuse}/include/osxfuse/fuse'
+    substituteInPlace src/CMakeLists.txt \
+      --replace 'target_link_libraries(unionfs fuse pthread)' 'target_link_libraries(unionfs osxfuse pthread)'
+  '';
 
   nativeBuildInputs = [ cmake ];
-  buildInputs = [ fuse ];
+  buildInputs = [ (if stdenv.isDarwin then osxfuse else fuse) ];
 
   # Put the unionfs mount helper in place as mount.unionfs-fuse. This makes it
   # possible to do:
@@ -28,7 +35,7 @@ stdenv.mkDerivation rec {
   #
   # This must be done in preConfigure because the build process removes
   # helper from the source directory during the build.
-  preConfigure = ''
+  preConfigure = lib.optionalString (!stdenv.isDarwin) ''
     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
@@ -39,7 +46,7 @@ stdenv.mkDerivation rec {
     description = "FUSE UnionFS implementation";
     homepage = "https://github.com/rpodgorny/unionfs-fuse";
     license = licenses.bsd3;
-    platforms = platforms.linux;
+    platforms = platforms.unix;
     maintainers = with maintainers; [ orivej ];
   };
 }