2008-11-23 02:28:52 +01:00
|
|
|
# HAL daemon.
|
2008-12-04 16:48:27 +01:00
|
|
|
{pkgs, config, ...}:
|
2007-06-09 22:05:04 +02:00
|
|
|
|
2008-11-23 02:28:52 +01: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 02:29:25 +01:00
|
|
|
inherit (pkgs.lib) mkIf;
|
2008-11-23 02:28:52 +01: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 22:13:12 +02:00
|
|
|
|
2007-06-09 22:05:04 +02:00
|
|
|
|
2008-11-23 02:28:52 +01:00
|
|
|
job = {
|
|
|
|
name = "hal";
|
|
|
|
|
|
|
|
job = ''
|
|
|
|
description "HAL daemon"
|
2007-06-09 22:05:04 +02:00
|
|
|
|
2009-04-08 15:41:33 +02:00
|
|
|
# !!! TODO: make sure that HAL starts after acpid,
|
|
|
|
# otherwise hald-addon-acpi will grab /proc/acpi/event.
|
|
|
|
start on ${if config.powerManagement.enable then "acpid" else "dbus"}
|
2008-11-23 02:28:52 +01:00
|
|
|
stop on shutdown
|
|
|
|
|
|
|
|
start script
|
|
|
|
|
|
|
|
mkdir -m 0755 -p /var/cache/hald
|
2009-04-28 15:44:43 +02:00
|
|
|
|
|
|
|
rm -f /var/cache/hald/fdi-cache
|
2008-11-23 02:28:52 +01:00
|
|
|
|
|
|
|
end script
|
|
|
|
|
|
|
|
respawn ${hal}/sbin/hald --daemon=no
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
in
|
|
|
|
|
2008-11-23 02:29:25 +01:00
|
|
|
mkIf cfg.enable {
|
2008-11-23 02:28:52 +01: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 02:28:58 +01:00
|
|
|
(import ../upstart-jobs/dbus.nix) # services.dbus.*
|
2008-11-23 02:28:52 +01:00
|
|
|
# (import ?) # config.environment.extraPackages
|
|
|
|
options
|
|
|
|
];
|
2007-06-09 22:05:04 +02:00
|
|
|
|
2008-11-23 02:28:52 +01:00
|
|
|
environment = {
|
2008-11-23 02:29:25 +01:00
|
|
|
extraPackages = [hal];
|
2008-11-23 02:28:52 +01:00
|
|
|
};
|
2007-06-09 22:05:04 +02:00
|
|
|
|
2008-11-23 02:28:52 +01:00
|
|
|
users = {
|
2008-11-23 02:29:25 +01:00
|
|
|
extraUsers = [user];
|
|
|
|
extraGroups = [group];
|
2008-11-23 02:28:52 +01:00
|
|
|
};
|
2007-06-09 22:05:04 +02:00
|
|
|
|
2008-11-23 02:28:52 +01:00
|
|
|
services = {
|
2008-11-23 02:29:25 +01:00
|
|
|
extraJobs = [job];
|
2007-06-09 22:05:04 +02:00
|
|
|
|
2008-11-23 02:28:52 +01:00
|
|
|
udev = {
|
2008-11-23 02:29:25 +01:00
|
|
|
addUdevPkgs = [hal];
|
2008-11-23 02:28:52 +01:00
|
|
|
};
|
2008-03-22 17:05:01 +01:00
|
|
|
|
2008-11-23 02:28:52 +01:00
|
|
|
dbus = {
|
2008-11-23 02:29:25 +01:00
|
|
|
enable = true;
|
|
|
|
services = [hal];
|
2008-11-23 02:28:52 +01:00
|
|
|
};
|
|
|
|
};
|
2007-06-09 22:05:04 +02:00
|
|
|
}
|