about summary refs log tree commit diff
path: root/pkgs/tools/filesystems/apfs-fuse/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/filesystems/apfs-fuse/default.nix')
-rw-r--r--pkgs/tools/filesystems/apfs-fuse/default.nix20
1 files changed, 17 insertions, 3 deletions
diff --git a/pkgs/tools/filesystems/apfs-fuse/default.nix b/pkgs/tools/filesystems/apfs-fuse/default.nix
index 4abea4a242361..0beffca1a54ee 100644
--- a/pkgs/tools/filesystems/apfs-fuse/default.nix
+++ b/pkgs/tools/filesystems/apfs-fuse/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchFromGitHub, fuse3, bzip2, zlib, attr, cmake }:
+{ lib, stdenv, fetchFromGitHub, fuse, fuse3, bzip2, zlib, attr, cmake }:
 
 stdenv.mkDerivation {
   pname = "apfs-fuse-unstable";
@@ -12,9 +12,23 @@ stdenv.mkDerivation {
     fetchSubmodules = true;
   };
 
-  buildInputs = [ fuse3 bzip2 zlib attr ];
+  postPatch = lib.optionalString stdenv.isDarwin ''
+    substituteInPlace CMakeLists.txt \
+      --replace "/usr/local/lib/libosxfuse.dylib" "fuse"
+  '';
+
   nativeBuildInputs = [ cmake ];
 
+  buildInputs = [
+    (if stdenv.isDarwin then fuse else fuse3)
+    bzip2
+    zlib
+  ] ++ lib.optional stdenv.isLinux attr;
+
+  cmakeFlags = lib.optional stdenv.isDarwin "-DUSE_FUSE3=OFF";
+
+  env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-DUSE_FUSE2";
+
   postFixup = ''
     ln -s $out/bin/apfs-fuse $out/bin/mount.fuse.apfs-fuse
   '';
@@ -24,7 +38,7 @@ stdenv.mkDerivation {
     description = "FUSE driver for APFS (Apple File System)";
     license     = licenses.gpl2Plus;
     maintainers = with maintainers; [ ealasu ];
-    platforms   = platforms.linux;
+    platforms   = platforms.unix;
   };
 
 }