convert "upstart-jobs/atd.nix" to a configuration file. Remove extra occurrences of "atd" from other files.

svn path=/nixos/branches/fix-style/; revision=13680
This commit is contained in:
Nicolas Pierron 2009-01-02 16:07:10 +00:00
parent 86ad3e36d5
commit 79bfab0e07
5 changed files with 91 additions and 49 deletions

View file

@ -224,7 +224,6 @@ let
}
)
[
"atd"
"login"
"slim"
"su"

View file

@ -693,25 +693,6 @@ in
};
atd = {
enable = mkOption {
default = true;
description = ''
Whether to enable the `at' daemon, a command scheduler.
'';
};
allowEveryone = mkOption {
default = false;
description = ''
Whether to make /var/spool/at{jobs,spool} writeable
by everyone (and sticky).
'';
};
};
ttyBackgrounds = {
enable = mkOption {
@ -2886,6 +2867,7 @@ root ALL=(ALL) SETENV: ALL
# services
(import ../upstart-jobs/avahi-daemon.nix)
(import ../upstart-jobs/atd.nix)
(import ../upstart-jobs/dbus.nix)
(import ../upstart-jobs/hal.nix)
(import ../upstart-jobs/gpm.nix)

View file

@ -159,7 +159,6 @@ 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.networking.defaultMailServer.directDelivery pkgs.ssmtp
++ config.environment.extraPackages
@ -201,7 +200,6 @@ rec {
config.security.setuidPrograms ++
config.security.extraSetuidPrograms ++
pkgs.lib.optional config.security.sudo.enable "sudo" ++
pkgs.lib.optionals config.services.atd.enable ["at" "atq" "atrm"] ++
pkgs.lib.optional (config.services.xserver.sessionType == "kde") "kcheckpass" ++
map ( x : x.program ) config.security.setuidOwners;

View file

@ -1,24 +1,50 @@
{ at, config }:
{pkgs, config, ...}:
let uid = (import ../system/ids.nix).uids.atd;
gid = (import ../system/ids.nix).gids.atd;
###### interface
let
inherit (pkgs.lib) mkOption;
options = {
services = {
atd = {
enable = mkOption {
default = true;
description = ''
Whether to enable the `at' daemon, a command scheduler.
'';
};
allowEveryone = mkOption {
default = false;
description = ''
Whether to make /var/spool/at{jobs,spool} writeable
by everyone (and sticky).
'';
};
};
};
};
in
{
name = "atd";
users = [
{ name = "atd";
inherit uid;
description = "atd user";
home = "/var/empty";
}
];
groups = [
{ name = "atd";
inherit gid;
}
];
###### implementation
let
cfg = config.services.atd;
inherit (pkgs.lib) mkIf;
inherit (pkgs) at;
user = {
name = "atd";
uid = (import ../system/ids.nix).uids.atd;
description = "atd user";
home = "/var/empty";
};
group = {
name = "atd";
gid = (import ../system/ids.nix).gids.atd;
};
job = ''
description "at daemon (atd)"
@ -44,7 +70,7 @@ start script
fi
done
chmod 1770 "$spooldir" "$jobdir"
${if config.allowEveryone then ''chmod a+rwxt "$spooldir" "$jobdir" '' else ""}
${if cfg.allowEveryone then ''chmod a+rwxt "$spooldir" "$jobdir" '' else ""}
if [ ! -f "$etcdir"/at.deny ]
then
touch "$etcdir"/at.deny && \
@ -61,5 +87,49 @@ end script
respawn ${at}/sbin/atd
'';
in
mkIf cfg.enable {
require = [
options
# config.services.extraJobs
(import ../upstart-jobs/default.nix)
# config.environment.etc
(import ../etc/default.nix)
# users.*
(import ../system/users-groups.nix)
# (import ?) # config.environment.extraPackages
# (import ?) # config.security.extraSetuidPrograms
];
security = {
extraSetuidPrograms = [
"at" "atq" "atrm"
];
};
environment = {
extraPackages = [ at ];
etc = [{
source = ../etc/pam.d/atd;
target = "pam.d/atd";
}];
};
users = {
extraUsers = [user];
extraGroups = [group];
};
services = {
extraJobs = [{
name = "atd";
inherit job;
}];
};
}

View file

@ -220,13 +220,6 @@ let
])
# At daemon.
++ optional config.services.atd.enable
(import ../upstart-jobs/atd.nix {
at = pkgs.at;
config = config.services.atd;
})
# ifplugd daemon for monitoring Ethernet cables.
++ optional config.networking.interfaceMonitor.enable
(import ../upstart-jobs/ifplugd.nix {