From 670fc54922d520f6a7f9dbd0f7f7d595aba1713a Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Fri, 28 Apr 2023 22:46:51 +0300 Subject: [PATCH] apfs-fuse: add darwin support --- pkgs/tools/filesystems/apfs-fuse/default.nix | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/filesystems/apfs-fuse/default.nix b/pkgs/tools/filesystems/apfs-fuse/default.nix index 4abea4a2423..0beffca1a54 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; }; }