From c595604bed30d4e6a63ec1d20ba430897ebda653 Mon Sep 17 00:00:00 2001 From: midchildan Date: Tue, 23 Mar 2021 23:15:56 +0900 Subject: [PATCH 1/2] fuse: use macfuse-stubs instead on Darwin --- pkgs/development/python-modules/llfuse/default.nix | 6 ++---- pkgs/os-specific/darwin/macfuse/default.nix | 8 +++++++- pkgs/tools/filesystems/bindfs/default.nix | 6 ++---- pkgs/tools/filesystems/s3fs/default.nix | 6 ++---- pkgs/tools/filesystems/unionfs-fuse/default.nix | 6 +++--- pkgs/top-level/all-packages.nix | 3 ++- pkgs/top-level/python-packages.nix | 1 - 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/pkgs/development/python-modules/llfuse/default.nix b/pkgs/development/python-modules/llfuse/default.nix index 4e68beba532b..e74263cdb77e 100644 --- a/pkgs/development/python-modules/llfuse/default.nix +++ b/pkgs/development/python-modules/llfuse/default.nix @@ -1,5 +1,5 @@ { lib, stdenv, fetchPypi, fetchpatch, buildPythonPackage, pkg-config, pytest, fuse, attr, which -, contextlib2, macfuse-stubs, DiskArbitration +, contextlib2 }: buildPythonPackage rec { @@ -21,9 +21,7 @@ buildPythonPackage rec { nativeBuildInputs = [ pkg-config ]; - buildInputs = - lib.optionals stdenv.isLinux [ fuse ] - ++ lib.optionals stdenv.isDarwin [ DiskArbitration macfuse-stubs ]; + buildInputs = [ fuse ]; checkInputs = [ pytest which ] ++ lib.optionals stdenv.isLinux [ attr ]; diff --git a/pkgs/os-specific/darwin/macfuse/default.nix b/pkgs/os-specific/darwin/macfuse/default.nix index a5162b3aed27..7e1b4ed7763c 100644 --- a/pkgs/os-specific/darwin/macfuse/default.nix +++ b/pkgs/os-specific/darwin/macfuse/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, cpio, xar, undmg, libtapi }: +{ lib, stdenv, fetchurl, cpio, xar, undmg, libtapi, DiskArbitration }: stdenv.mkDerivation rec { pname = "macfuse-stubs"; @@ -10,6 +10,7 @@ stdenv.mkDerivation rec { }; nativeBuildInputs = [ cpio xar undmg libtapi ]; + propagatedBuildInputs = [ DiskArbitration ]; postUnpack = '' xar -xf 'Install macFUSE.pkg' @@ -40,6 +41,11 @@ stdenv.mkDerivation rec { meta = with lib; { homepage = "https://osxfuse.github.io"; description = "Build time stubs for FUSE on macOS"; + longDescription = '' + macFUSE is required for this package to work on macOS. To install macFUSE, + use the installer from the + project website. + ''; platforms = platforms.darwin; maintainers = with maintainers; [ midchildan ]; diff --git a/pkgs/tools/filesystems/bindfs/default.nix b/pkgs/tools/filesystems/bindfs/default.nix index a6d2382a1a66..12052100db32 100644 --- a/pkgs/tools/filesystems/bindfs/default.nix +++ b/pkgs/tools/filesystems/bindfs/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, fuse, pkg-config, macfuse-stubs }: +{ lib, stdenv, fetchurl, fuse, pkg-config }: stdenv.mkDerivation rec { version = "1.15.1"; @@ -10,9 +10,7 @@ stdenv.mkDerivation rec { }; nativeBuildInputs = [ pkg-config ]; - buildInputs = if stdenv.isDarwin - then [ macfuse-stubs ] - else [ fuse ]; + buildInputs = [ fuse ]; postFixup = '' ln -s $out/bin/bindfs $out/bin/mount.fuse.bindfs ''; diff --git a/pkgs/tools/filesystems/s3fs/default.nix b/pkgs/tools/filesystems/s3fs/default.nix index 63a6153e8ca6..95b5b6ab34aa 100644 --- a/pkgs/tools/filesystems/s3fs/default.nix +++ b/pkgs/tools/filesystems/s3fs/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, curl, openssl, libxml2, fuse, macfuse-stubs }: +{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, curl, openssl, libxml2, fuse }: stdenv.mkDerivation rec { pname = "s3fs-fuse"; @@ -11,9 +11,7 @@ stdenv.mkDerivation rec { sha256 = "sha256-Agb0tq7B98Ioe0G/XEZCYcFQKnMuYXX9x0yg4Gvu3/k="; }; - buildInputs = [ curl openssl libxml2 ] - ++ lib.optionals stdenv.isLinux [ fuse ] - ++ lib.optionals stdenv.isDarwin [ macfuse-stubs ]; + buildInputs = [ curl openssl libxml2 fuse ]; nativeBuildInputs = [ autoreconfHook pkg-config ]; configureFlags = [ diff --git a/pkgs/tools/filesystems/unionfs-fuse/default.nix b/pkgs/tools/filesystems/unionfs-fuse/default.nix index acfd3b1e9a0b..6a34657d3d17 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, macfuse-stubs }: +{ lib, stdenv, fetchFromGitHub, cmake, fuse }: stdenv.mkDerivation rec { pname = "unionfs-fuse"; @@ -21,11 +21,11 @@ stdenv.mkDerivation rec { postPatch = lib.optionalString stdenv.isDarwin '' substituteInPlace CMakeLists.txt \ - --replace '/usr/local/include/osxfuse/fuse' '${macfuse-stubs}/include/fuse' + --replace '/usr/local/include/osxfuse/fuse' '${fuse}/include/fuse' ''; nativeBuildInputs = [ cmake ]; - buildInputs = [ (if stdenv.isDarwin then macfuse-stubs else fuse) ]; + buildInputs = [ fuse ]; # Put the unionfs mount helper in place as mount.unionfs-fuse. This makes it # possible to do: diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index eb66cdde0eed..2429c162a170 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19273,7 +19273,7 @@ in fusePackages = dontRecurseIntoAttrs (callPackage ../os-specific/linux/fuse { util-linux = util-linuxMinimal; }); - fuse = lowPrio fusePackages.fuse_2; + fuse = lowPrio (if stdenv.isDarwin then macfuse-stubs else fusePackages.fuse_2); fuse3 = fusePackages.fuse_3; fuse-common = hiPrio fusePackages.fuse_3.common; @@ -19412,6 +19412,7 @@ in macfuse-stubs = callPackage ../os-specific/darwin/macfuse { inherit (darwin) libtapi; + inherit (darwin.apple_sdk.frameworks) DiskArbitration; }; osxsnarf = callPackage ../os-specific/darwin/osxsnarf { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 149053326f6c..3e18ef3e99c7 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3968,7 +3968,6 @@ in { llfuse = callPackage ../development/python-modules/llfuse { inherit (pkgs) fuse; - inherit (pkgs.darwin.apple_sdk.frameworks) DiskArbitration; }; llvmlite = callPackage ../development/python-modules/llvmlite { From b67362d7f70a989a6f4bf6bb106207f53f0c6fe4 Mon Sep 17 00:00:00 2001 From: midchildan Date: Wed, 24 Mar 2021 02:22:15 +0900 Subject: [PATCH 2/2] doc: add section for FUSE --- doc/builders/packages/fuse.section.md | 19 +++++++++++++++++++ doc/builders/packages/index.xml | 1 + 2 files changed, 20 insertions(+) create mode 100644 doc/builders/packages/fuse.section.md diff --git a/doc/builders/packages/fuse.section.md b/doc/builders/packages/fuse.section.md new file mode 100644 index 000000000000..5603481115e7 --- /dev/null +++ b/doc/builders/packages/fuse.section.md @@ -0,0 +1,19 @@ +# FUSE {#sec-fuse} + +Some packages rely on +[FUSE](https://www.kernel.org/doc/html/latest/filesystems/fuse.html) to provide +support for additional filesystems not supported by the kernel. + +In general, FUSE software are primarily developed for Linux but many of them can +also run on macOS. Nixpkgs supports FUSE packages on macOS, but it requires +[macFUSE](https://osxfuse.github.io) to be installed outside of Nix. macFUSE +currently isn't packaged in Nixpkgs mainly because it includes a kernel +extension, which isn't supported by Nix outside of NixOS. + +If a package fails to run on macOS with an error message similar to the +following, it's a likely sign that you need to have macFUSE installed. + + dyld: Library not loaded: /usr/local/lib/libfuse.2.dylib + Referenced from: /nix/store/w8bi72bssv0bnxhwfw3xr1mvn7myf37x-sshfs-fuse-2.10/bin/sshfs + Reason: image not found + [1] 92299 abort /nix/store/w8bi72bssv0bnxhwfw3xr1mvn7myf37x-sshfs-fuse-2.10/bin/sshfs diff --git a/doc/builders/packages/index.xml b/doc/builders/packages/index.xml index e1e2fef3f16a..9653bae472d4 100644 --- a/doc/builders/packages/index.xml +++ b/doc/builders/packages/index.xml @@ -12,6 +12,7 @@ +