2008-11-23 01:28:52 +00:00
|
|
|
# HAL daemon.
|
2008-12-04 15:48:27 +00:00
|
|
|
{pkgs, config, ...}:
|
2007-06-09 21:05:04 +01:00
|
|
|
|
2008-11-23 01:28:52 +00:00
|
|
|
###### 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;
|
2008-11-23 01:29:25 +00:00
|
|
|
inherit (pkgs.lib) mkIf;
|
2008-11-23 01:28:52 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
2007-06-10 21:13:12 +01:00
|
|
|
|
2007-06-09 21:05:04 +01:00
|
|
|
|
2008-11-23 01:28:52 +00:00
|
|
|
job = {
|
|
|
|
name = "hal";
|
|
|
|
|
|
|
|
job = ''
|
|
|
|
description "HAL daemon"
|
2007-06-09 21:05:04 +01:00
|
|
|
|
2009-02-22 16:08:28 +00:00
|
|
|
# !!! TODO: make sure that HAL starts after acpid,
|
|
|
|
# otherwise hald-addon-acpi will grab /proc/acpi/event.
|
2009-02-22 16:09:07 +00:00
|
|
|
start on ${if config.powerManagement.enable then "acpid" else "dbus"}
|
2008-11-23 01:28:52 +00:00
|
|
|
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
|
|
|
|
|
2008-11-23 01:29:25 +00:00
|
|
|
mkIf cfg.enable {
|
2008-11-23 01:28:52 +00:00
|
|
|
require = [
|
|
|
|
(import ../upstart-jobs/default.nix) # config.services.extraJobs
|
|
|
|
# (import ../system/user.nix) # users.*
|
|
|
|
# (import ../upstart-jobs/udev.nix) # services.udev.*
|
2008-11-23 01:28:58 +00:00
|
|
|
(import ../upstart-jobs/dbus.nix) # services.dbus.*
|
2008-11-23 01:28:52 +00:00
|
|
|
# (import ?) # config.environment.extraPackages
|
|
|
|
options
|
|
|
|
];
|
2007-06-09 21:05:04 +01:00
|
|
|
|
2008-11-23 01:28:52 +00:00
|
|
|
environment = {
|
2008-11-23 01:29:25 +00:00
|
|
|
extraPackages = [hal];
|
2008-11-23 01:28:52 +00:00
|
|
|
};
|
2007-06-09 21:05:04 +01:00
|
|
|
|
2008-11-23 01:28:52 +00:00
|
|
|
users = {
|
2008-11-23 01:29:25 +00:00
|
|
|
extraUsers = [user];
|
|
|
|
extraGroups = [group];
|
2008-11-23 01:28:52 +00:00
|
|
|
};
|
2007-06-09 21:05:04 +01:00
|
|
|
|
2008-11-23 01:28:52 +00:00
|
|
|
services = {
|
2008-11-23 01:29:25 +00:00
|
|
|
extraJobs = [job];
|
2007-06-09 21:05:04 +01:00
|
|
|
|
2008-11-23 01:28:52 +00:00
|
|
|
udev = {
|
2008-11-23 01:29:25 +00:00
|
|
|
addUdevPkgs = [hal];
|
2008-11-23 01:28:52 +00:00
|
|
|
};
|
2008-03-22 16:05:01 +00:00
|
|
|
|
2008-11-23 01:28:52 +00:00
|
|
|
dbus = {
|
2008-11-23 01:29:25 +00:00
|
|
|
enable = true;
|
|
|
|
services = [hal];
|
2008-11-23 01:28:52 +00:00
|
|
|
};
|
|
|
|
};
|
2007-06-09 21:05:04 +01:00
|
|
|
}
|