2008-11-23 02:28:52 +01:00
|
|
|
# HAL daemon.
|
|
|
|
{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;
|
|
|
|
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;
|
|
|
|
};
|
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
|
|
|
|
2008-11-23 02:28:52 +01:00
|
|
|
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
|
|
|
|
|
|
|
|
{
|
|
|
|
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
|
|
|
|
];
|
2007-06-09 22:05:04 +02:00
|
|
|
|
2008-11-23 02:28:52 +01:00
|
|
|
environment = {
|
|
|
|
extraPackages = ifEnable [hal];
|
|
|
|
};
|
2007-06-09 22:05:04 +02:00
|
|
|
|
2008-11-23 02:28:52 +01:00
|
|
|
users = {
|
|
|
|
extraUsers = ifEnable [user];
|
|
|
|
extraGroups = ifEnable [group];
|
|
|
|
};
|
2007-06-09 22:05:04 +02:00
|
|
|
|
2008-11-23 02:28:52 +01:00
|
|
|
services = {
|
|
|
|
extraJobs = ifEnable [job];
|
2007-06-09 22:05:04 +02:00
|
|
|
|
2008-11-23 02:28:52 +01:00
|
|
|
udev = {
|
|
|
|
addUdevPkgs = ifEnable [hal];
|
|
|
|
};
|
2008-03-22 17:05:01 +01:00
|
|
|
|
2008-11-23 02:28:52 +01:00
|
|
|
dbus = {
|
|
|
|
enable = cfg.enable;
|
|
|
|
# services = ifEnable [hal];
|
|
|
|
};
|
|
|
|
};
|
2007-06-09 22:05:04 +02:00
|
|
|
}
|