2008-11-23 02:28:52 +01:00
|
|
|
# HAL daemon.
|
2009-10-12 19:27:57 +02:00
|
|
|
{ config, pkgs, ... }:
|
2007-06-09 22:05:04 +02:00
|
|
|
|
2009-08-10 20:25:09 +02:00
|
|
|
with pkgs.lib;
|
2008-11-23 02:28:52 +01:00
|
|
|
|
|
|
|
let
|
2009-08-10 20:25:09 +02:00
|
|
|
|
2008-11-23 02:28:52 +01:00
|
|
|
cfg = config.services.hal;
|
|
|
|
|
|
|
|
inherit (pkgs) hal;
|
|
|
|
|
2009-08-11 23:16:59 +02:00
|
|
|
fdi = pkgs.buildEnv {
|
|
|
|
name = "hal-fdi";
|
|
|
|
pathsToLink = [ "/share/hal/fdi" ];
|
|
|
|
paths = cfg.packages;
|
|
|
|
};
|
2007-06-09 22:05:04 +02:00
|
|
|
|
2009-08-10 20:25:09 +02:00
|
|
|
in
|
2007-06-09 22:05:04 +02:00
|
|
|
|
2009-08-10 20:25:09 +02:00
|
|
|
{
|
2008-11-23 02:28:52 +01:00
|
|
|
|
2009-08-10 20:25:09 +02:00
|
|
|
###### interface
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-08-10 20:25:09 +02:00
|
|
|
options = {
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-08-10 20:25:09 +02:00
|
|
|
services.hal = {
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-08-10 20:25:09 +02:00
|
|
|
enable = mkOption {
|
2011-07-25 02:52:59 +02:00
|
|
|
default = false;
|
2009-08-11 23:16:59 +02:00
|
|
|
description = ''
|
2009-08-10 20:25:09 +02:00
|
|
|
Whether to start the HAL daemon.
|
2009-08-11 23:16:59 +02:00
|
|
|
'';
|
2009-08-10 20:25:09 +02:00
|
|
|
};
|
2008-11-23 02:28:52 +01:00
|
|
|
|
2009-08-11 23:16:59 +02:00
|
|
|
packages = mkOption {
|
2009-08-10 20:25:09 +02:00
|
|
|
default = [];
|
2009-08-11 23:16:59 +02:00
|
|
|
description = ''
|
|
|
|
Packages containing additional HAL configuration data.
|
|
|
|
'';
|
2009-08-10 20:25:09 +02:00
|
|
|
};
|
2008-11-23 02:28:52 +01:00
|
|
|
|
2009-08-10 20:25:09 +02:00
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-08-10 20:25:09 +02:00
|
|
|
};
|
2008-11-23 02:28:52 +01:00
|
|
|
|
2009-05-20 17:43:43 +02:00
|
|
|
|
2009-08-10 20:25:09 +02:00
|
|
|
###### implementation
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-08-10 20:25:09 +02:00
|
|
|
config = mkIf cfg.enable {
|
2008-11-23 02:28:52 +01:00
|
|
|
|
2009-11-15 13:48:42 +01:00
|
|
|
environment.systemPackages = [ hal ];
|
2007-06-09 22:05:04 +02:00
|
|
|
|
2009-11-15 13:48:42 +01:00
|
|
|
services.hal.packages = [ hal pkgs.hal_info ];
|
2009-08-11 23:16:59 +02:00
|
|
|
|
2011-07-25 02:52:59 +02:00
|
|
|
security.policykit.enable = true;
|
|
|
|
|
2009-08-10 20:25:09 +02:00
|
|
|
users.extraUsers = singleton
|
|
|
|
{ name = "haldaemon";
|
|
|
|
uid = config.ids.uids.haldaemon;
|
|
|
|
description = "HAL daemon user";
|
|
|
|
};
|
2007-06-09 22:05:04 +02:00
|
|
|
|
2009-08-10 20:25:09 +02:00
|
|
|
users.extraGroups = singleton
|
|
|
|
{ name = "haldaemon";
|
|
|
|
gid = config.ids.gids.haldaemon;
|
|
|
|
};
|
2007-06-09 22:05:04 +02:00
|
|
|
|
2009-10-12 20:09:34 +02:00
|
|
|
jobs.hal =
|
2009-10-12 19:27:57 +02:00
|
|
|
{ description = "HAL daemon";
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-11-15 13:48:42 +01:00
|
|
|
startOn = "started dbus" + optionalString config.services.acpid.enable " and started acpid";
|
2009-08-10 20:25:09 +02:00
|
|
|
|
|
|
|
environment =
|
2009-09-26 22:37:48 +02: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 23:16:59 +02:00
|
|
|
HAL_FDI_SOURCE_INFORMATION = "${fdi}/share/hal/fdi/information";
|
|
|
|
HAL_FDI_SOURCE_POLICY = "${fdi}/share/hal/fdi/policy";
|
2009-09-26 22:37:48 +02:00
|
|
|
|
|
|
|
# Stuff needed by the shell scripts run by HAL (in particular pm-utils).
|
|
|
|
HALD_RUNNER_PATH = concatStringsSep ":"
|
|
|
|
[ "${pkgs.coreutils}/bin"
|
|
|
|
"${pkgs.gnugrep}/bin"
|
2011-08-26 19:30:53 +02:00
|
|
|
"${pkgs.dbus_tools}/bin"
|
2009-09-26 22:37:48 +02:00
|
|
|
"${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 20:25:09 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
preStart =
|
|
|
|
''
|
|
|
|
mkdir -m 0755 -p /var/cache/hald
|
2009-09-09 23:22:00 +02:00
|
|
|
mkdir -m 0755 -p /var/run/hald
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-08-10 20:25:09 +02:00
|
|
|
rm -f /var/cache/hald/fdi-cache
|
|
|
|
'';
|
|
|
|
|
2009-11-06 16:23:16 +01: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 20:25:09 +02:00
|
|
|
};
|
2008-03-22 17:05:01 +01:00
|
|
|
|
2009-08-10 21:05:20 +02:00
|
|
|
services.udev.packages = [hal];
|
2009-08-10 20:25:09 +02:00
|
|
|
|
|
|
|
services.dbus.enable = true;
|
|
|
|
services.dbus.packages = [hal];
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2008-11-23 02:28:52 +01:00
|
|
|
};
|
2009-08-10 20:25:09 +02:00
|
|
|
|
2009-11-15 13:48:42 +01:00
|
|
|
}
|