2008-11-23 01:28:52 +00:00
|
|
|
# HAL daemon.
|
2009-10-12 18:27:57 +01:00
|
|
|
{ config, pkgs, ... }:
|
2007-06-09 21:05:04 +01:00
|
|
|
|
2009-08-10 19:25:09 +01:00
|
|
|
with pkgs.lib;
|
2008-11-23 01:28:52 +00:00
|
|
|
|
|
|
|
let
|
2009-08-10 19:25:09 +01:00
|
|
|
|
2008-11-23 01:28:52 +00:00
|
|
|
cfg = config.services.hal;
|
|
|
|
|
|
|
|
inherit (pkgs) hal;
|
|
|
|
|
2009-08-11 22:16:59 +01:00
|
|
|
fdi = pkgs.buildEnv {
|
|
|
|
name = "hal-fdi";
|
|
|
|
pathsToLink = [ "/share/hal/fdi" ];
|
|
|
|
paths = cfg.packages;
|
|
|
|
};
|
2007-06-09 21:05:04 +01:00
|
|
|
|
2009-08-10 19:25:09 +01:00
|
|
|
in
|
2007-06-09 21:05:04 +01:00
|
|
|
|
2009-08-10 19:25:09 +01:00
|
|
|
{
|
2008-11-23 01:28:52 +00:00
|
|
|
|
2009-08-10 19:25:09 +01:00
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
services.hal = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
|
|
|
default = true;
|
2009-08-11 22:16:59 +01:00
|
|
|
description = ''
|
2009-08-10 19:25:09 +01:00
|
|
|
Whether to start the HAL daemon.
|
2009-08-11 22:16:59 +01:00
|
|
|
'';
|
2009-08-10 19:25:09 +01:00
|
|
|
};
|
2008-11-23 01:28:52 +00:00
|
|
|
|
2009-08-11 22:16:59 +01:00
|
|
|
packages = mkOption {
|
2009-08-10 19:25:09 +01:00
|
|
|
default = [];
|
2009-08-11 22:16:59 +01:00
|
|
|
description = ''
|
|
|
|
Packages containing additional HAL configuration data.
|
|
|
|
'';
|
2009-08-10 19:25:09 +01:00
|
|
|
};
|
2008-11-23 01:28:52 +00:00
|
|
|
|
2009-08-10 19:25:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
2008-11-23 01:28:52 +00:00
|
|
|
|
2009-05-20 16:43:43 +01:00
|
|
|
|
2009-08-10 19:25:09 +01:00
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2008-11-23 01:28:52 +00:00
|
|
|
|
2009-11-15 12:48:42 +00:00
|
|
|
environment.systemPackages = [ hal ];
|
2007-06-09 21:05:04 +01:00
|
|
|
|
2009-11-15 12:48:42 +00:00
|
|
|
services.hal.packages = [ hal pkgs.hal_info ];
|
2009-08-11 22:16:59 +01:00
|
|
|
|
2009-08-10 19:25:09 +01:00
|
|
|
users.extraUsers = singleton
|
|
|
|
{ name = "haldaemon";
|
|
|
|
uid = config.ids.uids.haldaemon;
|
|
|
|
description = "HAL daemon user";
|
|
|
|
};
|
2007-06-09 21:05:04 +01:00
|
|
|
|
2009-08-10 19:25:09 +01:00
|
|
|
users.extraGroups = singleton
|
|
|
|
{ name = "haldaemon";
|
|
|
|
gid = config.ids.gids.haldaemon;
|
|
|
|
};
|
2007-06-09 21:05:04 +01:00
|
|
|
|
2009-10-12 19:09:34 +01:00
|
|
|
jobs.hal =
|
2009-10-12 18:27:57 +01:00
|
|
|
{ description = "HAL daemon";
|
2009-08-10 19:25:09 +01:00
|
|
|
|
2009-11-15 12:48:42 +00:00
|
|
|
startOn = "started dbus" + optionalString config.services.acpid.enable " and started acpid";
|
2009-08-10 19:25:09 +01:00
|
|
|
|
|
|
|
environment =
|
2009-09-26 21:37:48 +01:00
|
|
|
{ # !!! HACK? These environment variables manipulated inside
|
|
|
|
# 'src'/hald/mmap_cache.c are used for testing the daemon.
|
|
|
|
HAL_FDI_SOURCE_PREPROBE = "${fdi}/share/hal/fdi/preprobe";
|
2009-08-11 22:16:59 +01:00
|
|
|
HAL_FDI_SOURCE_INFORMATION = "${fdi}/share/hal/fdi/information";
|
|
|
|
HAL_FDI_SOURCE_POLICY = "${fdi}/share/hal/fdi/policy";
|
2009-09-26 21:37:48 +01:00
|
|
|
|
|
|
|
# Stuff needed by the shell scripts run by HAL (in particular pm-utils).
|
|
|
|
HALD_RUNNER_PATH = concatStringsSep ":"
|
|
|
|
[ "${pkgs.coreutils}/bin"
|
|
|
|
"${pkgs.gnugrep}/bin"
|
|
|
|
"${pkgs.dbus.tools}/bin"
|
|
|
|
"${pkgs.procps}/bin"
|
|
|
|
"${pkgs.procps}/sbin"
|
|
|
|
"${config.system.sbin.modprobe}/sbin"
|
|
|
|
"${pkgs.module_init_tools}/bin"
|
|
|
|
"${pkgs.module_init_tools}/sbin"
|
|
|
|
"${pkgs.kbd}/bin"
|
|
|
|
];
|
2009-08-10 19:25:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
preStart =
|
|
|
|
''
|
|
|
|
mkdir -m 0755 -p /var/cache/hald
|
2009-09-09 22:22:00 +01:00
|
|
|
mkdir -m 0755 -p /var/run/hald
|
2009-08-10 19:25:09 +01:00
|
|
|
|
|
|
|
rm -f /var/cache/hald/fdi-cache
|
|
|
|
'';
|
|
|
|
|
2009-11-06 15:23:16 +00:00
|
|
|
daemonType = "fork";
|
|
|
|
|
|
|
|
# The `PATH=' works around a bug in HAL: it concatenates
|
|
|
|
# its libexec directory to $PATH, but using a 512-byte
|
|
|
|
# buffer. So if $PATH is too long it fails.
|
|
|
|
script = "PATH= exec ${hal}/sbin/hald --use-syslog";
|
2009-08-10 19:25:09 +01:00
|
|
|
};
|
2008-03-22 16:05:01 +00:00
|
|
|
|
2009-08-10 20:05:20 +01:00
|
|
|
services.udev.packages = [hal];
|
2009-08-10 19:25:09 +01:00
|
|
|
|
|
|
|
services.dbus.enable = true;
|
|
|
|
services.dbus.packages = [hal];
|
|
|
|
|
2008-11-23 01:28:52 +00:00
|
|
|
};
|
2009-08-10 19:25:09 +01:00
|
|
|
|
2009-11-15 12:48:42 +00:00
|
|
|
}
|