nixpkgs/modules/services/networking/portmap.nix
Eelco Dolstra 5ebdee3577 * Continued refactoring the tree: moved most Upstart jobs (namely
those that run daemons) to modules/services.  This probably broke
  some things since there are a few relative paths in modules
  (e.g. imports of system/ids.nix).
* Moved some PAM modules out of etc/pam.d to the directories of NixOS
  modules that use them.

svn path=/nixos/branches/modular-nixos/; revision=15717
2009-05-24 23:13:23 +00:00

90 lines
1.8 KiB
Nix

{pkgs, config, ...}:
###### interface
let
inherit (pkgs.lib) mkOption mkIf;
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.
'';
};
verbose = mkOption {
default = false;
description = ''
Whether to enable verbose output.
'';
};
chroot = mkOption {
default = "/var/empty";
description = ''
If non-empty, a path to change root to.
'';
};
};
};
};
in
###### implementation
let uid = (import ../../../system/ids.nix).uids.portmap;
gid = (import ../../../system/ids.nix).gids.portmap;
in
mkIf config.services.portmap.enable {
require = [
options
];
users = {
extraUsers = [
{ name = "portmap";
inherit uid;
description = "portmap daemon user";
home = "/var/empty";
}
];
extraGroups = [
{ name = "portmap";
inherit gid;
}
];
};
services = {
extraJobs = [{
name = "portmap";
job =
let portmap = pkgs.portmap.override { daemonUID = uid; daemonGID = gid; };
in
''
description "ONC RPC portmap"
start on network-interfaces/started
stop on network-interfaces/stop
respawn ${portmap}/sbin/portmap -f \
${if config.services.portmap.chroot == ""
then ""
else "-t \"${config.services.portmap.chroot}\""} \
${if config.services.portmap.verbose then "-v" else ""}
'';
}];
};
}