about summary refs log tree commit diff
path: root/pkgs/tools/filesystems/ntfs-3g/default.nix
blob: 56d6bdc7fba2ef01cacabf04feb72963ce200027 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config
, gettext, mount, libuuid, kmod, macfuse-stubs, DiskArbitration
, crypto ? false, libgcrypt, gnutls
}:

stdenv.mkDerivation rec {
  pname = "ntfs3g";
  version = "2022.10.3";

  outputs = [ "out" "dev" "man" "doc" ];

  src = fetchFromGitHub {
    owner = "tuxera";
    repo = "ntfs-3g";
    rev = version;
    sha256 = "sha256-nuFTsGkm3zmSzpwmhyY7Ke0VZfZU0jHOzEWaLBbglQk=";
  };

  buildInputs = [ gettext libuuid ]
    ++ lib.optionals crypto [ gnutls libgcrypt ]
    ++ lib.optionals stdenv.isDarwin [ macfuse-stubs DiskArbitration ];

  # Note: libgcrypt is listed here non-optionally because its m4 macros are
  # being used in ntfs-3g's configure.ac.
  nativeBuildInputs = [ autoreconfHook libgcrypt pkg-config ];

  patches = [
    # https://github.com/tuxera/ntfs-3g/pull/39
    ./autoconf-sbin-helpers.patch
    ./consistent-sbindir-usage.patch
  ];

  configureFlags = [
    "--disable-ldconfig"
    "--exec-prefix=\${prefix}"
    "--enable-mount-helper"
    "--enable-posix-acls"
    "--enable-xattr-mappings"
    "--${if crypto then "enable" else "disable"}-crypto"
    "--enable-extras"
    "--with-mount-helper=${mount}/bin/mount"
    "--with-umount-helper=${mount}/bin/umount"
  ] ++ lib.optionals stdenv.isLinux [
    "--with-modprobe-helper=${kmod}/bin/modprobe"
  ];

  postInstall =
    ''
      # Prefer ntfs-3g over the ntfs driver in the kernel.
      ln -sv mount.ntfs-3g $out/sbin/mount.ntfs
    '';

  enableParallelBuilding = true;

  meta = with lib; {
    homepage = "https://github.com/tuxera/ntfs-3g";
    description = "FUSE-based NTFS driver with full write support";
    maintainers = with maintainers; [ dezgeg ];
    platforms = with platforms; darwin ++ linux;
    license = with licenses; [
      gpl2Plus # ntfs-3g itself
      lgpl2Plus # fuse-lite
    ];
  };
}