1{ fetchurl, stdenv, lib, tcp_wrappers
2, daemonUser ? false, daemonUID ? false, daemonGID ? false }:
3
4assert daemonUser -> (!daemonUID && !daemonGID);
5
6stdenv.mkDerivation rec {
7 name = "portmap-6.0";
8
9 src = fetchurl {
10 url = "http://neil.brown.name/portmap/${name}.tgz";
11 sha256 = "1pj13ll4mbfwjwpn3fbg03qq9im6v2i8fcpa3ffp4viykz9j1j02";
12 };
13
14 patches = [ ./reuse-socket.patch ];
15
16 postPatch = ''
17 substituteInPlace "Makefile" --replace "/usr/share" "" \
18 --replace "install -o root -g root" "install"
19 '';
20
21 makeFlags =
22 lib.optional (daemonUser != false) "RPCUSER=\"${daemonUser}\""
23 ++ lib.optional (daemonUID != false) "DAEMON_UID=${toString daemonUID}"
24 ++ lib.optional (daemonGID != false) "DAEMON_GID=${toString daemonGID}";
25
26 buildInputs = [ tcp_wrappers ];
27
28 installPhase = ''
29 mkdir -p "$out/sbin" "$out/man/man8"
30 make install BASEDIR=$out
31 '';
32
33 meta = {
34 description = "ONC RPC portmapper";
35 longDescription = ''
36 Portmap is part of the ONC RPC software collection implementing
37 remote procedure calls (RPCs) between computer programs. It is
38 widely used by NFS and NIS, among others.
39 '';
40
41 homepage = http://neil.brown.name/portmap/;
42 license = "BSD";
43 platforms = stdenv.lib.platforms.linux;
44 };
45}