2020-11-24 15:29:28 +00:00
|
|
|
{ stdenv, fetchurl, fetchpatch, lib, pkgconfig, util-linux, libcap, libtirpc, libevent
|
2017-01-29 18:11:35 +00:00
|
|
|
, sqlite, kerberos, kmod, libuuid, keyutils, lvm2, systemd, coreutils, tcp_wrappers
|
2020-08-12 10:07:33 +01:00
|
|
|
, python3, buildPackages, nixosTests, rpcsvc-proto
|
2020-04-02 19:56:42 +01:00
|
|
|
, enablePython ? true
|
2014-09-30 09:25:38 +01:00
|
|
|
}:
|
2008-03-30 18:42:49 +01:00
|
|
|
|
2017-01-29 18:11:35 +00:00
|
|
|
let
|
2020-11-24 15:29:28 +00:00
|
|
|
statdPath = lib.makeBinPath [ systemd util-linux coreutils ];
|
2018-10-11 16:40:20 +01:00
|
|
|
in
|
2017-01-29 18:11:35 +00:00
|
|
|
|
2018-10-11 16:40:20 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "nfs-utils";
|
2020-08-12 10:07:33 +01:00
|
|
|
version = "2.5.1";
|
2007-11-20 15:55:37 +00:00
|
|
|
|
2008-01-30 17:20:48 +00:00
|
|
|
src = fetchurl {
|
2019-08-15 13:41:18 +01:00
|
|
|
url = "https://kernel.org/pub/linux/utils/nfs-utils/${version}/${pname}-${version}.tar.xz";
|
2020-08-12 10:07:33 +01:00
|
|
|
sha256 = "1i1h3n2m35q9ixs1i2qf1rpjp10cipa3c25zdf1xj1vaw5q8270g";
|
2007-11-20 15:55:37 +00:00
|
|
|
};
|
|
|
|
|
2018-08-29 13:26:53 +01:00
|
|
|
# libnfsidmap is built together with nfs-utils from the same source,
|
|
|
|
# put it in the "lib" output, and the headers in "dev"
|
|
|
|
outputs = [ "out" "dev" "lib" "man" ];
|
|
|
|
|
2020-08-12 10:07:33 +01:00
|
|
|
nativeBuildInputs = [ pkgconfig buildPackages.stdenv.cc rpcsvc-proto ];
|
2017-01-29 18:11:35 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
2018-08-29 13:26:53 +01:00
|
|
|
libtirpc libcap libevent sqlite lvm2
|
2017-01-29 18:11:35 +00:00
|
|
|
libuuid keyutils kerberos tcp_wrappers
|
2020-04-02 19:56:42 +01:00
|
|
|
] ++ lib.optional enablePython python3;
|
2017-01-29 18:11:35 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
2010-04-27 10:43:22 +01:00
|
|
|
|
2018-10-11 16:40:20 +01:00
|
|
|
preConfigure =
|
|
|
|
''
|
|
|
|
substituteInPlace configure \
|
|
|
|
--replace '$dir/include/gssapi' ${lib.getDev kerberos}/include/gssapi \
|
|
|
|
--replace '$dir/bin/krb5-config' ${lib.getDev kerberos}/bin/krb5-config
|
|
|
|
'';
|
|
|
|
|
2010-04-27 10:43:22 +01:00
|
|
|
configureFlags =
|
2017-01-29 18:11:35 +00:00
|
|
|
[ "--enable-gss"
|
2019-11-27 14:36:36 +00:00
|
|
|
"--enable-svcgss"
|
2010-04-27 10:43:22 +01:00
|
|
|
"--with-statedir=/var/lib/nfs"
|
2018-10-11 16:40:20 +01:00
|
|
|
"--with-krb5=${lib.getLib kerberos}"
|
2018-08-30 19:11:40 +01:00
|
|
|
"--with-systemd=${placeholder "out"}/etc/systemd/system"
|
2017-01-29 18:11:35 +00:00
|
|
|
"--enable-libmount-mount"
|
2018-08-30 19:11:40 +01:00
|
|
|
"--with-pluginpath=${placeholder "lib"}/lib/libnfsidmap" # this installs libnfsidmap
|
2020-12-12 09:23:30 +00:00
|
|
|
"--with-rpcgen=${buildPackages.rpcsvc-proto}/bin/rpcgen"
|
2020-08-12 10:07:33 +01:00
|
|
|
];
|
2010-04-27 10:43:22 +01:00
|
|
|
|
2019-08-30 03:17:02 +01:00
|
|
|
patches = lib.optionals stdenv.hostPlatform.isMusl [
|
2018-04-23 20:24:55 +01:00
|
|
|
(fetchpatch {
|
|
|
|
url = "https://raw.githubusercontent.com/alpinelinux/aports/cb880042d48d77af412d4688f24b8310ae44f55f/main/nfs-utils/0011-exportfs-only-do-glibc-specific-hackery-on-glibc.patch";
|
|
|
|
sha256 = "0rrddrykz8prk0dcgfvmnz0vxn09dbgq8cb098yjjg19zz6d7vid";
|
|
|
|
})
|
|
|
|
# http://openwall.com/lists/musl/2015/08/18/10
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://raw.githubusercontent.com/alpinelinux/aports/cb880042d48d77af412d4688f24b8310ae44f55f/main/nfs-utils/musl-getservbyport.patch";
|
|
|
|
sha256 = "1fqws9dz8n1d9a418c54r11y3w330qgy2652dpwcy96cm44sqyhf";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2017-01-29 18:11:35 +00:00
|
|
|
postPatch =
|
2015-02-16 12:51:21 +00:00
|
|
|
''
|
2017-01-29 18:11:35 +00:00
|
|
|
patchShebangs tests
|
|
|
|
sed -i "s,/usr/sbin,$out/bin,g" utils/statd/statd.c
|
|
|
|
sed -i "s,^PATH=.*,PATH=$out/bin:${statdPath}," utils/statd/start-statd
|
|
|
|
|
|
|
|
configureFlags="--with-start-statd=$out/bin/start-statd $configureFlags"
|
2017-09-18 10:42:40 +01:00
|
|
|
|
2017-07-06 19:43:22 +01:00
|
|
|
substituteInPlace systemd/nfs-utils.service \
|
|
|
|
--replace "/bin/true" "${coreutils}/bin/true"
|
2017-06-08 19:43:04 +01:00
|
|
|
|
|
|
|
substituteInPlace utils/mount/Makefile.in \
|
|
|
|
--replace "chmod 4511" "chmod 0511"
|
2017-11-08 09:27:39 +00:00
|
|
|
|
|
|
|
sed '1i#include <stdint.h>' -i support/nsm/rpc.c
|
2015-02-16 12:51:21 +00:00
|
|
|
'';
|
|
|
|
|
2017-01-29 18:11:35 +00:00
|
|
|
makeFlags = [
|
|
|
|
"sbindir=$(out)/bin"
|
|
|
|
"generator_dir=$(out)/etc/systemd/system-generators"
|
|
|
|
];
|
|
|
|
|
|
|
|
installFlags = [
|
|
|
|
"statedir=$(TMPDIR)"
|
|
|
|
"statdpath=$(TMPDIR)"
|
|
|
|
];
|
|
|
|
|
2018-09-24 21:05:39 +01:00
|
|
|
stripDebugList = [ "lib" "libexec" "bin" "etc/systemd/system-generators" ];
|
|
|
|
|
2017-01-29 18:11:35 +00:00
|
|
|
postInstall =
|
2015-02-16 12:51:21 +00:00
|
|
|
''
|
2017-01-29 18:11:35 +00:00
|
|
|
# Not used on NixOS
|
|
|
|
sed -i \
|
|
|
|
-e "s,/sbin/modprobe,${kmod}/bin/modprobe,g" \
|
|
|
|
-e "s,/usr/sbin,$out/bin,g" \
|
|
|
|
$out/etc/systemd/system/*
|
2020-04-02 19:56:42 +01:00
|
|
|
'' + lib.optionalString (!enablePython) ''
|
|
|
|
# Remove all scripts that require python (currently mountstats and nfsiostat)
|
|
|
|
grep -l /usr/bin/python $out/bin/* | xargs -I {} rm -v {}
|
2015-02-16 12:51:21 +00:00
|
|
|
'';
|
2007-11-20 15:55:37 +00:00
|
|
|
|
2010-08-21 18:13:28 +01:00
|
|
|
# One test fails on mips.
|
2019-06-03 17:17:31 +01:00
|
|
|
# doCheck = !stdenv.isMips;
|
|
|
|
# https://bugzilla.kernel.org/show_bug.cgi?id=203793
|
|
|
|
doCheck = false;
|
2010-04-27 10:43:22 +01:00
|
|
|
|
2018-10-11 16:40:20 +01:00
|
|
|
disallowedReferences = [ (lib.getDev kerberos) ];
|
|
|
|
|
2019-12-13 11:24:48 +00:00
|
|
|
passthru.tests = {
|
|
|
|
nfs3-simple = nixosTests.nfs3.simple;
|
|
|
|
nfs4-simple = nixosTests.nfs4.simple;
|
|
|
|
nfs4-kerberos = nixosTests.nfs4.kerberos;
|
|
|
|
};
|
|
|
|
|
2017-01-29 18:11:35 +00:00
|
|
|
meta = with stdenv.lib; {
|
2008-03-30 18:42:49 +01:00
|
|
|
description = "Linux user-space NFS utilities";
|
|
|
|
|
|
|
|
longDescription = ''
|
|
|
|
This package contains various Linux user-space Network File
|
|
|
|
System (NFS) utilities, including RPC `mount' and `nfs'
|
|
|
|
daemons.
|
|
|
|
'';
|
|
|
|
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://linux-nfs.org/";
|
2017-01-29 18:11:35 +00:00
|
|
|
license = licenses.gpl2;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ abbradar ];
|
2007-11-20 15:55:37 +00:00
|
|
|
};
|
|
|
|
}
|