Convert "hal" upstart-job to the fix-style.

svn path=/nixos/branches/fix-style/; revision=13377
This commit is contained in:
Nicolas Pierron 2008-11-23 01:28:52 +00:00
parent 585fd9d911
commit dc634f5297
3 changed files with 89 additions and 50 deletions

View File

@ -1943,18 +1943,6 @@ in
};
hal = {
enable = mkOption {
default = true;
description = "
Whether to start the HAL daemon.
";
};
};
udev = {
addFirmware = mkOption {
@ -3019,6 +3007,7 @@ root ALL=(ALL) SETENV: ALL
(import ../upstart-jobs/pcmcia.nix)
# services
(import ../upstart-jobs/hal.nix)
(import ../upstart-jobs/gpm.nix)
(import ../upstart-jobs/nagios/default.nix)
(import ../upstart-jobs/zabbix-agent.nix)

View File

@ -145,8 +145,7 @@ let
++ pkgs.lib.optional config.hardware.enableGo7007 "${kernelPackages.wis_go7007}/firmware"
++ config.services.udev.addFirmware;
extraUdevPkgs =
pkgs.lib.optional config.services.hal.enable pkgs.hal
++ pkgs.lib.optional config.hardware.enableGo7007 kernelPackages.wis_go7007
pkgs.lib.optional config.hardware.enableGo7007 kernelPackages.wis_go7007
++ config.services.udev.addUdevPkgs;
})
@ -394,18 +393,13 @@ let
(import ../upstart-jobs/dbus.nix {
inherit (pkgs) stdenv dbus;
dbusServices =
# add config.services.dbus.services
pkgs.lib.optional config.services.hal.enable pkgs.hal ++
pkgs.lib.optional config.services.avahi.enable pkgs.avahi ++
pkgs.lib.optional config.services.disnix.enable pkgs.disnix
;
})
# HAL daemon.
++ optional config.services.hal.enable
(import ../upstart-jobs/hal.nix {
inherit (pkgs) stdenv hal;
})
# Postfix mail server.
++ optional config.services.postfix.enable
(import ../upstart-jobs/postfix.nix {

View File

@ -1,39 +1,95 @@
{stdenv, hal}:
# HAL daemon.
{pkgs, config}:
###### interface
let
inherit (pkgs.lib) mkOption;
options = {
services = {
hal = {
enable = mkOption {
default = true;
description = "
Whether to start the HAL daemon.
";
};
};
};
};
in
###### implementation
let
cfg = config.services.hal;
ifEnable = pkgs.lib.ifEnable cfg.enable;
inherit (pkgs) hal;
user = {
name = "haldaemon";
uid = (import ../system/ids.nix).uids.haldaemon;
description = "HAL daemon user";
};
group = {
name = "haldaemon";
gid = (import ../system/ids.nix).gids.haldaemon;
};
job = {
name = "hal";
job = ''
description "HAL daemon"
start on dbus
stop on shutdown
start script
# !!! quick hack: wait until dbus has started
sleep 3
mkdir -m 0755 -p /var/cache/hald
end script
respawn ${hal}/sbin/hald --daemon=no
'';
};
in
{
name = "hal";
users = [
{ name = "haldaemon";
uid = (import ../system/ids.nix).uids.haldaemon;
description = "HAL daemon user";
}
require = [
(import ../upstart-jobs/default.nix) # config.services.extraJobs
# (import ../system/user.nix) # users.*
# (import ../upstart-jobs/udev.nix) # services.udev.*
# (import ../upstart-jobs/dbus.nix) # services.dbus.*
# (import ?) # config.environment.extraPackages
options
];
groups = [
{ name = "haldaemon";
gid = (import ../system/ids.nix).gids.haldaemon;
}
];
environment = {
extraPackages = ifEnable [hal];
};
extraPath = [hal];
job = ''
description "HAL daemon"
users = {
extraUsers = ifEnable [user];
extraGroups = ifEnable [group];
};
start on dbus
stop on shutdown
services = {
extraJobs = ifEnable [job];
start script
udev = {
addUdevPkgs = ifEnable [hal];
};
# !!! quick hack: wait until dbus has started
sleep 3
mkdir -m 0755 -p /var/cache/hald
end script
respawn ${hal}/sbin/hald --daemon=no
'';
dbus = {
enable = cfg.enable;
# services = ifEnable [hal];
};
};
}