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

View File

@ -148,12 +148,6 @@ let
gnunetConfig = config.services.gnunet; gnunetConfig = config.services.gnunet;
}) })
# portmap daemon.
++ optional config.services.portmap.enable
(import ../upstart-jobs/portmap.nix {
inherit (pkgs) makePortmap;
})
# Apache httpd. # Apache httpd.
++ optional (config.services.httpd.enable && !config.services.httpd.experimental) ++ optional (config.services.httpd.enable && !config.services.httpd.experimental)
(import ../upstart-jobs/httpd.nix { (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; let uid = (import ../system/ids.nix).uids.portmap;
gid = (import ../system/ids.nix).gids.portmap; gid = (import ../system/ids.nix).gids.portmap;
in in
{
name = "portmap";
users = [ mkIf config.services.portmap.enable {
{ name = "portmap";
inherit uid; require = [
description = "portmap daemon user"; options
home = "/var/empty";
}
]; ];
groups = [
{ name = "portmap";
inherit gid;
}
];
job = users = {
let portmap = makePortmap { daemonUID = uid; daemonGID = gid; }; extraUsers = [
in { name = "portmap";
'' inherit uid;
description "ONC RPC portmap" description = "portmap daemon user";
home = "/var/empty";
}
];
start on network-interfaces/started extraGroups = [
stop on network-interfaces/stop { 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
'';
}];
};
} }