Add `atd' Upstart job.

svn path=/nixos/trunk/; revision=11435
This commit is contained in:
Ludovic Courtès 2008-04-01 10:16:35 +00:00
parent 2c7d02288f
commit a0fc21eda3
7 changed files with 90 additions and 1 deletions

View File

@ -233,6 +233,7 @@ import ../helpers/make-etc.nix {
}
)
[
"atd"
"login"
"slim"
"su"

4
etc/pam.d/atd Normal file
View File

@ -0,0 +1,4 @@
auth include common
account include common
password include common
session include common

View File

@ -13,6 +13,7 @@
bitlbee = 9;
avahi = 10;
portmap = 11;
atd = 12;
nixbld = 30000; # start of range of uids
nobody = 65534;
@ -27,6 +28,8 @@
bitlbee = 9;
avahi = 10;
portmap = 11;
atd = 12;
audio = 17;
users = 100;

View File

@ -611,6 +611,15 @@
};
atd = {
enable = mkOption {
default = true;
description = ''
Whether to enable the `at' daemon, a command scheduler.
'';
};
};
locate = {

View File

@ -257,6 +257,7 @@ rec {
pkgs.wirelesstools
]
++ pkgs.lib.optional config.security.sudo.enable pkgs.sudo
++ pkgs.lib.optional config.services.atd.enable pkgs.at
++ pkgs.lib.optional config.services.bitlbee.enable pkgs.bitlbee
++ pkgs.lib.optional config.services.avahi.enable pkgs.avahi
++ pkgs.lib.optional config.networking.defaultMailServer.directDelivery pkgs.ssmtp
@ -304,7 +305,8 @@ rec {
setuidPrograms =
config.security.setuidPrograms ++
config.security.extraSetuidPrograms ++
pkgs.lib.optional (config.security.sudo.enable) "sudo";
pkgs.lib.optional (config.security.sudo.enable) "sudo" ++
(if (config.services.atd.enable) then [ "at" "atq" "atrm" ] else []);
inherit (usersGroups) createUsersGroups usersList groupsList;

64
upstart-jobs/atd.nix Normal file
View File

@ -0,0 +1,64 @@
{ at }:
let uid = (import ../system/ids.nix).uids.atd;
gid = (import ../system/ids.nix).gids.atd;
in
{
name = "atd";
users = [
{ name = "atd";
inherit uid;
description = "atd user";
home = "/var/empty";
}
];
groups = [
{ name = "atd";
inherit gid;
}
];
job = ''
description "at daemon (atd)"
start on startup
stop on shutdown
start script
# Snippets taken and adapted from the original `install' rule of
# the makefile.
# We assume these values are those actually used in Nixpkgs for
# `at'.
spooldir=/var/spool/atspool
jobdir=/var/spool/atjobs
etcdir=/etc/at
for dir in "$spooldir" "$jobdir" "$etcdir"
do
if [ ! -d "$dir" ]
then
mkdir "$dir" && chown atd:atd "$dir"
fi
done
chmod 1770 "$spooldir" "$jobdir"
if [ ! -f "$etcdir"/at.deny ]
then
touch "$etcdir"/at.deny && \
chown root:root "$etcdir"/at.deny && \
chmod 640 "$etcdir"/at.deny
fi
if [ ! -f "$jobdir"/.SEQ ]
then
touch "$jobdir"/.SEQ && \
chown atd:atd "$jobdir"/.SEQ && \
chmod 600 "$jobdir"/.SEQ
fi
end script
respawn ${at}/sbin/atd
'';
}

View File

@ -167,6 +167,12 @@ let
])
# At daemon.
++ optional config.services.atd.enable
(import ../upstart-jobs/atd.nix {
at = pkgs.at;
})
# DHCP client.
++ optional config.networking.useDHCP
(import ../upstart-jobs/dhclient.nix {