From 258ef4bf19aa64d59a2cefcc1e3618c280b64943 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 9 Jun 2007 20:05:04 +0000 Subject: [PATCH] * Upstart job for HAL. svn path=/nixos/trunk/; revision=8854 --- system/options.nix | 9 +++++++++ upstart-jobs/dbus.nix | 10 ++++++++-- upstart-jobs/default.nix | 8 ++++++++ upstart-jobs/hal.nix | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 upstart-jobs/hal.nix diff --git a/system/options.nix b/system/options.nix index 2364d91c9e0..49ad563b925 100644 --- a/system/options.nix +++ b/system/options.nix @@ -802,6 +802,15 @@ } + { + name = ["services" "hal" "enable"]; + default = true; + description = " + Whether to start the HAL daemon. + "; + } + + { name = ["installer" "nixpkgsURL"]; default = ""; diff --git a/upstart-jobs/dbus.nix b/upstart-jobs/dbus.nix index 58357ad1aab..d57b032524d 100644 --- a/upstart-jobs/dbus.nix +++ b/upstart-jobs/dbus.nix @@ -1,4 +1,4 @@ -{stdenv, dbus}: +{stdenv, dbus, dbusServices ? []}: let @@ -10,9 +10,13 @@ let name = "dbus-conf"; buildCommand = " ensureDir $out - ensureDir $out/system.d substitute ${dbus}/etc/dbus-1/system.conf $out/system.conf \\ --replace '' '' + + ensureDir $out/system.d + for i in ${toString dbusServices}; do + ln -s $i/etc/dbus-1/system.d/* $out/system.d/ + done "; }; @@ -29,6 +33,8 @@ in } ]; + extraPath = [dbus]; + job = " description \"D-Bus system message bus daemon\" diff --git a/upstart-jobs/default.nix b/upstart-jobs/default.nix index 9cab516539d..e4a804ba3a2 100644 --- a/upstart-jobs/default.nix +++ b/upstart-jobs/default.nix @@ -186,6 +186,14 @@ import ../upstart-jobs/gather.nix { ++ optional ["services" "dbus" "enable"] (import ../upstart-jobs/dbus.nix { inherit (pkgs) stdenv dbus; + dbusServices = + pkgs.lib.optional (config.get ["services" "hal" "enable"]) pkgs.hal; + }) + + # HAL daemon. + ++ optional ["services" "hal" "enable"] + (import ../upstart-jobs/hal.nix { + inherit (pkgs) stdenv hal; }) # Handles the reboot/halt events. diff --git a/upstart-jobs/hal.nix b/upstart-jobs/hal.nix new file mode 100644 index 00000000000..097722d0641 --- /dev/null +++ b/upstart-jobs/hal.nix @@ -0,0 +1,37 @@ +{stdenv, hal}: + +let + + homeDir = "/var/run/dbus"; + +in + +{ + name = "hal"; + + users = [ + { name = "haldaemon"; + uid = (import ../system/ids.nix).uids.haldaemon; + description = "HAL daemon user"; +# home = homeDir; + } + ]; + + extraPath = [hal]; + + job = " +description \"HAL daemon\" + +start on dbus +stop on shutdown + +start script + + mkdir -m 0755 -p /var/cache/hald + +end script + +respawn ${hal}/sbin/hald --daemon=no --verbose=yes + "; + +}