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