lol

fuse3: init at 3.1.1

This includes fuse-common (fusePackages.fuse_3.common) as recommended by
upstream. But while fuse(2) and fuse3 would normally depend on
fuse-common we can't do that in nixpkgs while fuse-common is just
another output from the fuse3 multiple-output derivation (i.e. this
would result in a circular dependency). To avoid building fuse3 twice I
decided it would be best to copy the shared files (i.e. the ones
provided by fuse(2) and fuse3) from fuse-common to fuse (version 2) and
avoid collision warnings by defining priorities. Now it should be
possible to install an arbitrary combination of "fuse", "fuse3", and
"fuse-common" without getting any collision warnings. The end result
should be the same and all changes should be backwards compatible
(assuming that mount.fuse from fuse3 is backwards compatible as stated
by upstream [0] - if not this might break some /etc/fstab definitions
but that should be very unlikely).

My tests with sshfs (version 2 and 3) didn't show any problems.

See #28409 for some additional information.

[0]: https://github.com/libfuse/libfuse/releases/tag/fuse-3.0.0

+97 -45
+1
nixos/modules/profiles/base.nix
··· 20 20 21 21 # Some networking tools. 22 22 pkgs.fuse 23 + pkgs.fuse3 23 24 pkgs.sshfs-fuse 24 25 pkgs.socat 25 26 pkgs.screen
+4 -1
nixos/modules/security/wrappers/default.nix
··· 155 155 ###### implementation 156 156 config = { 157 157 158 - security.wrappers.fusermount.source = "${pkgs.fuse}/bin/fusermount"; 158 + security.wrappers = { 159 + fusermount.source = "${pkgs.fuse}/bin/fusermount"; 160 + fusermount3.source = "${pkgs.fuse3}/bin/fusermount3"; 161 + }; 159 162 160 163 boot.specialFileSystems.${parentWrapperDir} = { 161 164 fsType = "tmpfs";
+1 -1
nixos/modules/tasks/filesystems.nix
··· 217 217 # Add the mount helpers to the system path so that `mount' can find them. 218 218 system.fsPackages = [ pkgs.dosfstools ]; 219 219 220 - environment.systemPackages = [ pkgs.fuse ] ++ config.system.fsPackages; 220 + environment.systemPackages = with pkgs; [ fuse3 fuse ] ++ config.system.fsPackages; 221 221 222 222 environment.etc.fstab.text = 223 223 let
+72
pkgs/os-specific/linux/fuse/common.nix
··· 1 + { version, sha256Hash, maintainers }: 2 + 3 + { stdenv, fetchFromGitHub, fetchpatch 4 + , utillinux, autoconf, automake, libtool, gettext 5 + , fusePackages }: 6 + 7 + let 8 + isFuse3 = stdenv.lib.hasPrefix "3" version; 9 + in stdenv.mkDerivation rec { 10 + name = "fuse-${version}"; 11 + 12 + src = fetchFromGitHub { 13 + owner = "libfuse"; 14 + repo = "libfuse"; 15 + rev = name; 16 + sha256 = sha256Hash; 17 + }; 18 + 19 + patches = stdenv.lib.optional 20 + (!isFuse3 && stdenv.isAarch64) 21 + (fetchpatch { 22 + url = "https://github.com/libfuse/libfuse/commit/914871b20a901e3e1e981c92bc42b1c93b7ab81b.patch"; 23 + sha256 = "1w4j6f1awjrycycpvmlv0x5v9gprllh4dnbjxl4dyl2jgbkaw6pa"; 24 + }); 25 + 26 + nativeBuildInputs = [ libtool autoconf automake ]; 27 + buildInputs = [ gettext utillinux ]; 28 + 29 + outputs = [ "out" ] ++ stdenv.lib.optional isFuse3 "common"; 30 + 31 + preConfigure = '' 32 + export MOUNT_FUSE_PATH=$out/sbin 33 + export INIT_D_PATH=$TMPDIR/etc/init.d 34 + export UDEV_RULES_PATH=$out/etc/udev/rules.d 35 + 36 + # Ensure that FUSE calls the setuid wrapper, not 37 + # $out/bin/fusermount. It falls back to calling fusermount in 38 + # $PATH, so it should also work on non-NixOS systems. 39 + export NIX_CFLAGS_COMPILE="-DFUSERMOUNT_DIR=\"/run/wrappers/bin\"" 40 + 41 + sed -e 's@/bin/@${utillinux}/bin/@g' -i lib/mount_util.c 42 + sed -e 's@CONFIG_RPATH=/usr/share/gettext/config.rpath@CONFIG_RPATH=${gettext}/share/gettext/config.rpath@' -i makeconf.sh 43 + 44 + ./makeconf.sh 45 + ''; 46 + 47 + postFixup = if isFuse3 then '' 48 + cd $out 49 + 50 + mv bin/mount.fuse3 bin/mount.fuse 51 + mv etc/udev/rules.d/99-fuse3.rules etc/udev/rules.d/99-fuse.rules 52 + 53 + install -D -m555 bin/mount.fuse $common/bin/mount.fuse 54 + install -D -m444 etc/udev/rules.d/99-fuse.rules $common/etc/udev/rules.d/99-fuse.rules 55 + install -D -m444 share/man/man8/mount.fuse.8.gz $common/share/man/man8/mount.fuse.8.gz 56 + '' else '' 57 + cd $out 58 + 59 + cp ${fusePackages.fuse_3.common}/bin/mount.fuse bin/mount.fuse 60 + cp ${fusePackages.fuse_3.common}/etc/udev/rules.d/99-fuse.rules etc/udev/rules.d/99-fuse.rules 61 + cp ${fusePackages.fuse_3.common}/share/man/man8/mount.fuse.8.gz share/man/man8/mount.fuse.8.gz 62 + ''; 63 + 64 + enableParallelBuilding = true; 65 + 66 + meta = { 67 + inherit (src.meta) homepage; 68 + description = "Kernel module and library that allows filesystems to be implemented in user space"; 69 + platforms = stdenv.lib.platforms.linux; 70 + inherit maintainers; 71 + }; 72 + }
+15 -42
pkgs/os-specific/linux/fuse/default.nix
··· 1 - { stdenv, fetchFromGitHub, fetchpatch, utillinux 2 - , autoconf, automake, libtool, gettext }: 1 + { stdenv, callPackage, utillinux }: 3 2 4 - stdenv.mkDerivation rec { 5 - name = "fuse-${version}"; 6 - version = "2.9.7"; 7 - 8 - src = fetchFromGitHub { 9 - owner = "libfuse"; 10 - repo = "libfuse"; 11 - rev = name; 12 - sha256 = "1wyjjfb7p4jrkk15zryzv33096a5fmsdyr2p4b00dd819wnly2n2"; 3 + let 4 + mkFuse = args: callPackage (import ./common.nix args) { 5 + inherit utillinux; 6 + }; 7 + maintainers = stdenv.lib.maintainers; 8 + in { 9 + fuse_2 = mkFuse { 10 + version = "2.9.7"; 11 + sha256Hash = "1wyjjfb7p4jrkk15zryzv33096a5fmsdyr2p4b00dd819wnly2n2"; 12 + maintainers = [ maintainers.mornfall ]; 13 13 }; 14 14 15 - buildInputs = [ utillinux autoconf automake libtool gettext ]; 16 - 17 - patches = stdenv.lib.optional stdenv.isAarch64 (fetchpatch { 18 - url = "https://github.com/libfuse/libfuse/commit/914871b20a901e3e1e981c92bc42b1c93b7ab81b.patch"; 19 - sha256 = "1w4j6f1awjrycycpvmlv0x5v9gprllh4dnbjxl4dyl2jgbkaw6pa"; 20 - }); 21 - 22 - preConfigure = 23 - '' 24 - export MOUNT_FUSE_PATH=$out/sbin 25 - export INIT_D_PATH=$TMPDIR/etc/init.d 26 - export UDEV_RULES_PATH=$out/etc/udev/rules.d 27 - 28 - # Ensure that FUSE calls the setuid wrapper, not 29 - # $out/bin/fusermount. It falls back to calling fusermount in 30 - # $PATH, so it should also work on non-NixOS systems. 31 - export NIX_CFLAGS_COMPILE="-DFUSERMOUNT_DIR=\"/run/wrappers/bin\"" 32 - 33 - sed -e 's@/bin/@${utillinux}/bin/@g' -i lib/mount_util.c 34 - sed -e 's@CONFIG_RPATH=/usr/share/gettext/config.rpath@CONFIG_RPATH=${gettext}/share/gettext/config.rpath@' -i makeconf.sh 35 - 36 - ./makeconf.sh 37 - ''; 38 - 39 - enableParallelBuilding = true; 40 - 41 - meta = with stdenv.lib; { 42 - homepage = https://github.com/libfuse/libfuse; 43 - description = "Kernel module and library that allows filesystems to be implemented in user space"; 44 - platforms = platforms.linux; 45 - maintainers = [ maintainers.mornfall ]; 15 + fuse_3 = mkFuse { 16 + version = "3.1.1"; 17 + sha256Hash = "14mazl2i55fp4vjphwgcmk3mp2x3mhqwh9nci0rd0jl5lhpdmpq6"; 18 + maintainers = [ maintainers.primeos ]; 46 19 }; 47 20 }
+4 -1
pkgs/top-level/all-packages.nix
··· 12052 12052 inherit (linuxPackages) kernel; 12053 12053 }; 12054 12054 12055 - fuse = callPackage ../os-specific/linux/fuse { 12055 + fusePackages = callPackage ../os-specific/linux/fuse { 12056 12056 utillinux = utillinuxMinimal; 12057 12057 }; 12058 + fuse = lowPrio fusePackages.fuse_2; 12059 + fuse3 = fusePackages.fuse_3; 12060 + fuse-common = hiPrio fusePackages.fuse_3.common; 12058 12061 12059 12062 fusionio-util = callPackage ../os-specific/linux/fusionio/util.nix { }; 12060 12063