2009-10-12 16:36:19 +00:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
2009-03-06 12:26:22 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
uid = config.ids.uids.portmap;
|
|
|
|
gid = config.ids.gids.portmap;
|
2009-02-24 19:17:25 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
portmap = pkgs.portmap.override { daemonUID = uid; daemonGID = gid; };
|
|
|
|
|
|
|
|
in
|
2009-02-24 20:41:58 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
{
|
2009-02-24 20:41:58 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
services.portmap = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Whether to enable `portmap', an ONC RPC directory service
|
|
|
|
notably used by NFS and NIS, and which can be queried
|
|
|
|
using the rpcinfo(1) command.
|
|
|
|
'';
|
2009-03-06 12:26:22 +00:00
|
|
|
};
|
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
verbose = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Whether to enable verbose output.
|
|
|
|
'';
|
|
|
|
};
|
2008-03-15 23:40:44 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
chroot = mkOption {
|
|
|
|
default = "/var/empty";
|
|
|
|
description = ''
|
|
|
|
If non-empty, a path to change root to.
|
|
|
|
'';
|
|
|
|
};
|
2008-03-15 23:40:44 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
};
|
2009-03-06 12:26:22 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
};
|
|
|
|
|
2008-03-15 23:40:44 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
###### implementation
|
2008-03-15 23:40:44 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
config = mkIf config.services.portmap.enable {
|
|
|
|
|
|
|
|
users.extraUsers = singleton
|
2009-03-06 12:26:22 +00:00
|
|
|
{ name = "portmap";
|
|
|
|
inherit uid;
|
2010-06-09 11:15:25 +00:00
|
|
|
description = "Portmap daemon user";
|
2009-03-06 12:26:22 +00:00
|
|
|
home = "/var/empty";
|
2009-10-12 16:36:19 +00:00
|
|
|
};
|
2009-03-06 12:26:22 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
users.extraGroups = singleton
|
2009-03-06 12:26:22 +00:00
|
|
|
{ name = "portmap";
|
|
|
|
inherit gid;
|
2009-10-12 16:36:19 +00:00
|
|
|
};
|
2009-03-06 12:26:22 +00:00
|
|
|
|
2009-10-12 18:09:34 +00:00
|
|
|
jobs.portmap =
|
2009-10-12 16:36:19 +00:00
|
|
|
{ description = "ONC RPC portmap";
|
2009-03-06 12:26:22 +00:00
|
|
|
|
2010-06-09 11:15:25 +00:00
|
|
|
startOn = "started network-interfaces";
|
2010-06-09 22:29:06 +00:00
|
|
|
stopOn = "never";
|
2010-06-09 11:15:25 +00:00
|
|
|
|
|
|
|
daemonType = "fork";
|
2009-03-06 12:26:22 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
exec =
|
|
|
|
''
|
2010-06-09 11:15:25 +00:00
|
|
|
${portmap}/sbin/portmap \
|
|
|
|
${optionalString (config.services.portmap.chroot != "")
|
|
|
|
"-t '${config.services.portmap.chroot}'"} \
|
2009-10-12 16:36:19 +00:00
|
|
|
${if config.services.portmap.verbose then "-v" else ""}
|
|
|
|
'';
|
|
|
|
};
|
2008-03-15 23:40:44 +00:00
|
|
|
|
2009-03-06 12:26:22 +00:00
|
|
|
};
|
2009-10-12 16:36:19 +00:00
|
|
|
|
2008-03-15 23:40:44 +00:00
|
|
|
}
|