a5c433696c
shutdown. (Portmap and statd are needed during shutdown to unmount NFS volumes but have open files in /var/run.) * In the shutdown job, don't kill PIDs belonging to Upstart jobs that are still running. If they don't stop on the "starting shutdown" event, then they're needed during shutdown (such as portmap and statd). * NFS test: test whether the shutdown quickly unmounts NFS volumes (i.e. whether portmap and statd are still running). svn path=/nixos/branches/boot-order/; revision=22204
86 lines
1.6 KiB
Nix
86 lines
1.6 KiB
Nix
{ config, pkgs, ... }:
|
|
|
|
with pkgs.lib;
|
|
|
|
let
|
|
|
|
uid = config.ids.uids.portmap;
|
|
gid = config.ids.gids.portmap;
|
|
|
|
portmap = pkgs.portmap.override { daemonUID = uid; daemonGID = gid; };
|
|
|
|
in
|
|
|
|
{
|
|
|
|
###### 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.
|
|
'';
|
|
};
|
|
|
|
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.
|
|
'';
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
###### implementation
|
|
|
|
config = mkIf config.services.portmap.enable {
|
|
|
|
users.extraUsers = singleton
|
|
{ name = "portmap";
|
|
inherit uid;
|
|
description = "Portmap daemon user";
|
|
home = "/var/empty";
|
|
};
|
|
|
|
users.extraGroups = singleton
|
|
{ name = "portmap";
|
|
inherit gid;
|
|
};
|
|
|
|
jobs.portmap =
|
|
{ description = "ONC RPC portmap";
|
|
|
|
startOn = "started network-interfaces";
|
|
stopOn = "never";
|
|
|
|
daemonType = "fork";
|
|
|
|
exec =
|
|
''
|
|
${portmap}/sbin/portmap \
|
|
${optionalString (config.services.portmap.chroot != "")
|
|
"-t '${config.services.portmap.chroot}'"} \
|
|
${if config.services.portmap.verbose then "-v" else ""}
|
|
'';
|
|
};
|
|
|
|
};
|
|
|
|
}
|