Merge pull request #228781 from wegank/apfs-fuse-darwin

apfs-fuse: add darwin support
This commit is contained in:
Weijia Wang 2023-04-29 11:47:19 +03:00 committed by GitHub
commit 87d526ff19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub, fuse3, bzip2, zlib, attr, cmake }: { lib, stdenv, fetchFromGitHub, fuse, fuse3, bzip2, zlib, attr, cmake }:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "apfs-fuse-unstable"; pname = "apfs-fuse-unstable";
@ -12,9 +12,23 @@ stdenv.mkDerivation {
fetchSubmodules = true; fetchSubmodules = true;
}; };
buildInputs = [ fuse3 bzip2 zlib attr ]; postPatch = lib.optionalString stdenv.isDarwin ''
substituteInPlace CMakeLists.txt \
--replace "/usr/local/lib/libosxfuse.dylib" "fuse"
'';
nativeBuildInputs = [ cmake ]; 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 = '' postFixup = ''
ln -s $out/bin/apfs-fuse $out/bin/mount.fuse.apfs-fuse 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)"; description = "FUSE driver for APFS (Apple File System)";
license = licenses.gpl2Plus; license = licenses.gpl2Plus;
maintainers = with maintainers; [ ealasu ]; maintainers = with maintainers; [ ealasu ];
platforms = platforms.linux; platforms = platforms.unix;
}; };
} }