Convert "portmap"

svn path=/nixos/branches/fix-style/; revision=14375
This commit is contained in:
Marc Weber 2009-03-06 12:26:22 +00:00
parent 2e93c3cdb9
commit adafcb8f32
3 changed files with 61 additions and 43 deletions

View file

@ -480,18 +480,6 @@ in
};
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.
'';
};
};
bitlbee = {
enable = mkOption {
@ -1543,6 +1531,7 @@ in
(import ../upstart-jobs/sshd.nix)
(import ../upstart-jobs/lshd.nix) # GNU lshd SSH2 deamon (TODO: does neither start nor generate seed file ?)
(import ../upstart-jobs/ntpd.nix)
(import ../upstart-jobs/portmap.nix)
# nix
(import ../upstart-jobs/nix.nix) # nix options and daemon

View file

@ -148,12 +148,6 @@ let
gnunetConfig = config.services.gnunet;
})
# portmap daemon.
++ optional config.services.portmap.enable
(import ../upstart-jobs/portmap.nix {
inherit (pkgs) makePortmap;
})
# Apache httpd.
++ optional (config.services.httpd.enable && !config.services.httpd.experimental)
(import ../upstart-jobs/httpd.nix {

View file

@ -1,35 +1,70 @@
{ makePortmap }:
{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.
'';
};
};
};
};
in
###### implementation
let uid = (import ../system/ids.nix).uids.portmap;
gid = (import ../system/ids.nix).gids.portmap;
in
{
name = "portmap";
users = [
{ name = "portmap";
inherit uid;
description = "portmap daemon user";
home = "/var/empty";
}
mkIf config.services.portmap.enable {
require = [
options
];
groups = [
{ name = "portmap";
inherit gid;
}
];
job =
let portmap = makePortmap { daemonUID = uid; daemonGID = gid; };
in
''
description "ONC RPC portmap"
users = {
extraUsers = [
{ name = "portmap";
inherit uid;
description = "portmap daemon user";
home = "/var/empty";
}
];
start on network-interfaces/started
stop on network-interfaces/stop
extraGroups = [
{ name = "portmap";
inherit gid;
}
];
};
respawn ${portmap}/sbin/portmap
'';
services = {
extraJobs = [{
name = "portmap";
job =
let portmap = pkgs.makePortmap { daemonUID = uid; daemonGID = gid; };
in
''
description "ONC RPC portmap"
start on network-interfaces/started
stop on network-interfaces/stop
respawn ${portmap}/sbin/portmap
'';
}];
};
}