2018-08-29 12:26:53 +00:00
|
|
|
{ stdenv, fetchurl, fetchpatch, lib, pkgconfig, utillinux, libcap, libtirpc, libevent
|
2017-01-29 18:11:35 +00:00
|
|
|
, sqlite, kerberos, kmod, libuuid, keyutils, lvm2, systemd, coreutils, tcp_wrappers
|
2017-12-17 13:51:32 +00:00
|
|
|
, buildEnv
|
2014-09-30 08:25:38 +00:00
|
|
|
}:
|
2008-03-30 17:42:49 +00:00
|
|
|
|
2017-01-29 18:11:35 +00:00
|
|
|
let
|
|
|
|
statdPath = lib.makeBinPath [ systemd utillinux coreutils ];
|
|
|
|
|
2017-12-17 13:51:32 +00:00
|
|
|
# Not nice; feel free to find a nicer solution.
|
|
|
|
kerberosEnv = buildEnv {
|
|
|
|
name = "kerberos-env-${kerberos.version}";
|
|
|
|
paths = with lib; [ (getDev kerberos) (getLib kerberos) ];
|
|
|
|
};
|
|
|
|
|
2017-01-29 18:11:35 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
name = "nfs-utils-${version}";
|
2018-08-29 12:26:53 +00:00
|
|
|
version = "2.3.2";
|
2007-11-20 15:55:37 +00:00
|
|
|
|
2008-01-30 17:20:48 +00:00
|
|
|
src = fetchurl {
|
2018-08-29 12:26:53 +00:00
|
|
|
url = "https://kernel.org/pub/linux/utils/nfs-utils/${version}/${name}.tar.xz";
|
|
|
|
sha256 = "06av6cjf8h18dpaxh8cd1awsra75zf6s5sj5r2z5g7scbj051ziw";
|
2007-11-20 15:55:37 +00:00
|
|
|
};
|
|
|
|
|
2018-08-29 12:26:53 +00: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" ];
|
|
|
|
|
2017-01-29 18:11:35 +00:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
|
|
|
|
|
|
|
buildInputs = [
|
2018-08-29 12:26:53 +00:00
|
|
|
libtirpc libcap libevent sqlite lvm2
|
2017-01-29 18:11:35 +00:00
|
|
|
libuuid keyutils kerberos tcp_wrappers
|
|
|
|
];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
2010-04-27 09:43:22 +00:00
|
|
|
|
|
|
|
configureFlags =
|
2017-01-29 18:11:35 +00:00
|
|
|
[ "--enable-gss"
|
2010-04-27 09:43:22 +00:00
|
|
|
"--with-statedir=/var/lib/nfs"
|
2017-12-17 13:51:32 +00:00
|
|
|
"--with-krb5=${kerberosEnv}"
|
2017-01-29 18:11:35 +00:00
|
|
|
"--with-systemd=$(out)/etc/systemd/system"
|
|
|
|
"--enable-libmount-mount"
|
2018-08-29 12:26:53 +00:00
|
|
|
# need an absolute path to lib output here.
|
|
|
|
# TODO: use ${placeholder lib} when nix 1.1 is no longer supported
|
|
|
|
"--with-pluginpath=@lib@/lib/libnfsidmap" # this installs libnfsidmap
|
2010-09-03 08:44:38 +00:00
|
|
|
]
|
2017-01-29 18:11:35 +00:00
|
|
|
++ lib.optional (stdenv ? glibc) "--with-rpcgen=${stdenv.glibc.bin}/bin/rpcgen";
|
2010-04-27 09:43:22 +00:00
|
|
|
|
2018-04-23 19:24:55 +00:00
|
|
|
patches = lib.optionals stdenv.hostPlatform.isMusl [
|
|
|
|
(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 09:42:40 +00:00
|
|
|
|
2017-07-06 18:43:22 +00:00
|
|
|
substituteInPlace systemd/nfs-utils.service \
|
|
|
|
--replace "/bin/true" "${coreutils}/bin/true"
|
2017-06-08 18:43:04 +00: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
|
|
|
'';
|
|
|
|
|
2018-08-29 12:26:53 +00:00
|
|
|
# TODO: remove when placeholders are allowed (see configureFlags)
|
|
|
|
postConfigure = ''
|
|
|
|
substituteInPlace support/include/config.h --replace '@lib@' "$lib"
|
|
|
|
'';
|
|
|
|
|
2017-01-29 18:11:35 +00:00
|
|
|
makeFlags = [
|
|
|
|
"sbindir=$(out)/bin"
|
|
|
|
"generator_dir=$(out)/etc/systemd/system-generators"
|
|
|
|
];
|
|
|
|
|
|
|
|
installFlags = [
|
|
|
|
"statedir=$(TMPDIR)"
|
|
|
|
"statdpath=$(TMPDIR)"
|
|
|
|
];
|
|
|
|
|
|
|
|
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/*
|
2015-02-16 12:51:21 +00:00
|
|
|
'';
|
2007-11-20 15:55:37 +00:00
|
|
|
|
2010-08-21 17:13:28 +00:00
|
|
|
# One test fails on mips.
|
2012-10-26 09:08:02 +00:00
|
|
|
doCheck = !stdenv.isMips;
|
2010-04-27 09:43:22 +00:00
|
|
|
|
2017-01-29 18:11:35 +00:00
|
|
|
meta = with stdenv.lib; {
|
2008-03-30 17:42:49 +00: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.
|
|
|
|
'';
|
|
|
|
|
2018-08-29 12:26:53 +00: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
|
|
|
};
|
|
|
|
}
|