···5656 lgpl2Plus # libfuse
5757 ];
5858 };
5959+6060+ passthru.warning = ''
6161+ macFUSE is required for this package to work on macOS. To install macFUSE,
6262+ use the installer from the <link xlink:href="https://osxfuse.github.io/">
6363+ project website</link>.
6464+ '';
5965}
+61
pkgs/tools/filesystems/sshfs-fuse/common.nix
···11+{ version, sha256, platforms, patches ? [ ] }:
22+33+{ lib, stdenv, fetchFromGitHub
44+, meson, pkg-config, ninja, docutils, makeWrapper
55+, fuse3, macfuse-stubs, glib
66+, which, python3Packages
77+, openssh
88+}:
99+1010+let
1111+ fuse = if stdenv.isDarwin then macfuse-stubs else fuse3;
1212+in stdenv.mkDerivation rec {
1313+ pname = "sshfs-fuse";
1414+ inherit version;
1515+1616+ src = fetchFromGitHub {
1717+ owner = "libfuse";
1818+ repo = "sshfs";
1919+ rev = "sshfs-${version}";
2020+ inherit sha256;
2121+ };
2222+2323+ inherit patches;
2424+2525+ nativeBuildInputs = [ meson pkg-config ninja docutils makeWrapper ];
2626+ buildInputs = [ fuse glib ];
2727+ checkInputs = [ which python3Packages.pytest ];
2828+2929+ NIX_CFLAGS_COMPILE = lib.optionalString
3030+ (stdenv.hostPlatform.system == "i686-linux")
3131+ "-D_FILE_OFFSET_BITS=64";
3232+3333+ postInstall = ''
3434+ mkdir -p $out/sbin
3535+ ln -sf $out/bin/sshfs $out/sbin/mount.sshfs
3636+ '' + lib.optionalString (!stdenv.isDarwin) ''
3737+ wrapProgram $out/bin/sshfs --prefix PATH : "${openssh}/bin"
3838+ '';
3939+4040+ # doCheck = true;
4141+ checkPhase = lib.optionalString (!stdenv.isDarwin) ''
4242+ # The tests need fusermount:
4343+ mkdir bin
4444+ cp ${fuse}/bin/fusermount3 bin/fusermount
4545+ export PATH=bin:$PATH
4646+ # Can't access /dev/fuse within the sandbox: "FUSE kernel module does not seem to be loaded"
4747+ substituteInPlace test/util.py --replace "/dev/fuse" "/dev/null"
4848+ # TODO: "fusermount executable not setuid, and we are not root"
4949+ # We should probably use a VM test instead
5050+ ${python3Packages.python.interpreter} -m pytest test/
5151+ '';
5252+5353+ meta = with lib; {
5454+ inherit platforms;
5555+ description = "FUSE-based filesystem that allows remote filesystems to be mounted over SSH";
5656+ longDescription = macfuse-stubs.warning;
5757+ homepage = "https://github.com/libfuse/sshfs";
5858+ license = licenses.gpl2Plus;
5959+ maintainers = with maintainers; [ primeos ];
6060+ };
6161+}
+25-49
pkgs/tools/filesystems/sshfs-fuse/default.nix
···11-{ lib, stdenv, fetchFromGitHub
22-, meson, pkg-config, ninja, docutils, makeWrapper
33-, fuse3, glib
44-, which, python3Packages
55-, openssh
66-}:
11+{ lib, stdenv, callPackage, fetchpatch }:
7288-stdenv.mkDerivation rec {
99- version = "3.7.1";
1010- pname = "sshfs-fuse";
33+let mkSSHFS = args: callPackage (import ./common.nix args) { };
44+in if stdenv.isDarwin then
55+ mkSSHFS {
66+ version = "2.10"; # macFUSE isn't yet compatible with libfuse 3.x
77+ sha256 = "1dmw4kx6vyawcywiv8drrajnam0m29mxfswcp4209qafzx3mjlp1";
88+ patches = [
99+ # remove reference to fuse_darwin.h which doens't exist on recent macFUSE
1010+ ./fix-fuse-darwin-h.patch
11111212- src = fetchFromGitHub {
1313- owner = "libfuse";
1414- repo = "sshfs";
1515- rev = "sshfs-${version}";
1212+ # From https://github.com/libfuse/sshfs/pull/185:
1313+ # > With this patch, setting I/O size to a reasonable large value, will
1414+ # > result in much improved performance, e.g.: -o iosize=1048576
1515+ (fetchpatch {
1616+ name = "fix-configurable-blksize.patch";
1717+ url = "https://github.com/libfuse/sshfs/commit/667cf34622e2e873db776791df275c7a582d6295.patch";
1818+ sha256 = "0d65lawd2g2aisk1rw2vl65dgxywf4vqgv765n9zj9zysyya8a54";
1919+ })
2020+ ];
2121+ platforms = lib.platforms.darwin;
2222+ }
2323+else
2424+ mkSSHFS {
2525+ version = "3.7.1";
1626 sha256 = "088mgcsqv9f2vly4xn6lvvkmqkgr9jjmjs9qp8938hl7j6rrgd17";
1717- };
1818-1919- nativeBuildInputs = [ meson pkg-config ninja docutils makeWrapper ];
2020- buildInputs = [ fuse3 glib ];
2121- checkInputs = [ which python3Packages.pytest ];
2222-2323- NIX_CFLAGS_COMPILE = lib.optionalString
2424- (stdenv.hostPlatform.system == "i686-linux")
2525- "-D_FILE_OFFSET_BITS=64";
2626-2727- postInstall = ''
2828- mkdir -p $out/sbin
2929- ln -sf $out/bin/sshfs $out/sbin/mount.sshfs
3030- wrapProgram $out/bin/sshfs --prefix PATH : "${openssh}/bin"
3131- '';
3232-3333- #doCheck = true;
3434- checkPhase = ''
3535- # The tests need fusermount:
3636- mkdir bin && cp ${fuse3}/bin/fusermount3 bin/fusermount
3737- export PATH=bin:$PATH
3838- # Can't access /dev/fuse within the sandbox: "FUSE kernel module does not seem to be loaded"
3939- substituteInPlace test/util.py --replace "/dev/fuse" "/dev/null"
4040- # TODO: "fusermount executable not setuid, and we are not root"
4141- # We should probably use a VM test instead
4242- python3 -m pytest test/
4343- '';
4444-4545- meta = with lib; {
4646- inherit (src.meta) homepage;
4747- description = "FUSE-based filesystem that allows remote filesystems to be mounted over SSH";
4848- platforms = platforms.linux;
4949- license = licenses.gpl2;
5050- maintainers = with maintainers; [ primeos ];
5151- };
5252-}
2727+ platforms = lib.platforms.linux;
2828+ }