Convert `portmap' Upstart job to the "new" style.
svn path=/nixos/trunk/; revision=14232
This commit is contained in:
parent
9e29c72bd2
commit
d1f57d6e1b
3 changed files with 64 additions and 48 deletions
|
@ -967,18 +967,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.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
avahi = {
|
||||
|
||||
enable = mkOption {
|
||||
|
@ -3081,5 +3069,6 @@ root ALL=(ALL) SETENV: ALL
|
|||
(import ../upstart-jobs/rogue.nix)
|
||||
(import ../upstart-jobs/guest-users.nix)
|
||||
(import ../upstart-jobs/pulseaudio.nix)
|
||||
(import ../upstart-jobs/portmap.nix)
|
||||
];
|
||||
}
|
||||
|
|
|
@ -220,12 +220,6 @@ let
|
|||
servers = config.services.ntp.servers;
|
||||
})
|
||||
|
||||
# portmap daemon.
|
||||
++ optional config.services.portmap.enable
|
||||
(import ../upstart-jobs/portmap.nix {
|
||||
inherit (pkgs) makePortmap;
|
||||
})
|
||||
|
||||
# Avahi daemon.
|
||||
++ optional config.services.avahi.enable
|
||||
(import ../upstart-jobs/avahi-daemon.nix {
|
||||
|
|
|
@ -1,35 +1,68 @@
|
|||
{ makePortmap }:
|
||||
{pkgs, config, ...}:
|
||||
|
||||
###### interface
|
||||
let
|
||||
inherit (pkgs.lib) mkOption mkIf;
|
||||
inherit (pkgs) makePortmap;
|
||||
|
||||
uid = (import ../system/ids.nix).uids.portmap;
|
||||
gid = (import ../system/ids.nix).gids.portmap;
|
||||
|
||||
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.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
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";
|
||||
}
|
||||
|
||||
###### implementation
|
||||
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"
|
||||
|
||||
start on network-interfaces/started
|
||||
stop on network-interfaces/stop
|
||||
|
||||
respawn ${portmap}/sbin/portmap
|
||||
'';
|
||||
|
||||
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 = makePortmap { daemonUID = uid; daemonGID = gid; };
|
||||
in ''
|
||||
description "ONC RPC portmap"
|
||||
|
||||
start on network-interfaces/started
|
||||
stop on network-interfaces/stop
|
||||
|
||||
respawn ${portmap}/sbin/portmap
|
||||
'';
|
||||
}];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue