mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-01 23:22:37 +00:00
addf00b1cf
svn path=/nixos/branches/modular-nixos/; revision=15371
97 lines
1.7 KiB
Nix
97 lines
1.7 KiB
Nix
# HAL daemon.
|
|
{pkgs, config, ...}:
|
|
|
|
###### 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;
|
|
inherit (pkgs.lib) mkIf;
|
|
|
|
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;
|
|
};
|
|
|
|
|
|
job = {
|
|
name = "hal";
|
|
|
|
job = ''
|
|
description "HAL daemon"
|
|
|
|
# !!! 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"}
|
|
stop on shutdown
|
|
|
|
start script
|
|
|
|
mkdir -m 0755 -p /var/cache/hald
|
|
|
|
rm -f /var/cache/hald/fdi-cache
|
|
|
|
end script
|
|
|
|
respawn ${hal}/sbin/hald --daemon=no
|
|
'';
|
|
};
|
|
in
|
|
|
|
mkIf cfg.enable {
|
|
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
|
|
];
|
|
|
|
environment = {
|
|
extraPackages = [hal];
|
|
};
|
|
|
|
users = {
|
|
extraUsers = [user];
|
|
extraGroups = [group];
|
|
};
|
|
|
|
services = {
|
|
extraJobs = [job];
|
|
|
|
udev = {
|
|
addUdevPkgs = [hal];
|
|
};
|
|
|
|
dbus = {
|
|
enable = true;
|
|
services = [hal];
|
|
};
|
|
};
|
|
}
|