nixpkgs/pkgs/tools/filesystems/ntfs-3g/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

66 lines
1.8 KiB
Nix

{ 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.hostPlatform.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.hostPlatform.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
];
};
}