From b581a56d79834fd7b89341e7db10a03acaa4837a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 6 Nov 2009 09:36:35 +0000 Subject: [PATCH] * Define the Upstart package to use in one place. svn path=/nixos/branches/upstart-0.6/; revision=18187 --- modules/config/system-path.nix | 2 +- modules/services/networking/dhclient.nix | 6 +++--- modules/services/networking/gw6c.nix | 4 +++- modules/services/x11/display-managers/kdm.nix | 4 ++-- modules/services/x11/display-managers/slim.nix | 4 ++-- modules/system/activation/top-level.nix | 6 +++--- modules/system/boot/stage-2.nix | 5 +++-- modules/system/upstart/upstart.nix | 7 ++++++- 8 files changed, 23 insertions(+), 15 deletions(-) diff --git a/modules/config/system-path.nix b/modules/config/system-path.nix index c2605d0963e1..50617ec91da5 100644 --- a/modules/config/system-path.nix +++ b/modules/config/system-path.nix @@ -10,6 +10,7 @@ let requiredPackages = [ config.system.sbin.modprobe # must take precedence over module_init_tools config.system.sbin.mount # must take precedence over util-linux + config.system.build.upstart config.environment.nix pkgs.acl pkgs.attr @@ -53,7 +54,6 @@ let pkgs.sysvtools pkgs.time pkgs.udev - pkgs.upstart pkgs.usbutils pkgs.utillinux ]; diff --git a/modules/services/networking/dhclient.nix b/modules/services/networking/dhclient.nix index 9696c8b14aa6..80451ce2a5a8 100644 --- a/modules/services/networking/dhclient.nix +++ b/modules/services/networking/dhclient.nix @@ -26,13 +26,13 @@ let # hostnames in its config file, then it will never do # anything ever again ("couldn't resolve ..., giving up on # it"), so we silently lose time synchronisation. - ${pkgs.upstart}/sbin/initctl stop ntpd + ${config.system.build.upstart}/sbin/initctl stop ntpd - ${pkgs.upstart}/sbin/initctl emit ip-up + ${config.system.build.upstart}/sbin/initctl emit ip-up fi if test "$reason" = EXPIRE -o "$reason" = RELEASE; then - ${pkgs.upstart}/sbin/initctl emit ip-down + ${config.system.build.upstart}/sbin/initctl emit ip-down fi ''; diff --git a/modules/services/networking/gw6c.nix b/modules/services/networking/gw6c.nix index 143fe57979aa..d723766bb2cb 100644 --- a/modules/services/networking/gw6c.nix +++ b/modules/services/networking/gw6c.nix @@ -6,10 +6,12 @@ let cfg = config.services.gw6c; + # !!! Move this from the services tree to the nixos tree. gw6cService = import (servicesPath + /gw6c) { inherit (pkgs) stdenv gw6c coreutils - procps upstart iputils gnused + procps iputils gnused gnugrep seccure writeScript; + upstart = config.system.build.upstart; username = cfg.username; password = cfg.password; server = cfg.server; diff --git a/modules/services/x11/display-managers/kdm.nix b/modules/services/x11/display-managers/kdm.nix index 349fd19adfe1..551710354429 100644 --- a/modules/services/x11/display-managers/kdm.nix +++ b/modules/services/x11/display-managers/kdm.nix @@ -12,8 +12,8 @@ let defaultConfig = '' [Shutdown] - HaltCmd=${pkgs.upstart}/sbin/halt - RebootCmd=${pkgs.upstart}/sbin/reboot + HaltCmd=${config.system.build.upstart}/sbin/halt + RebootCmd=${config.system.build.upstart}/sbin/reboot ${optionalString (config.system.boot.loader.id == "grub") '' BootManager=Grub ''} diff --git a/modules/services/x11/display-managers/slim.nix b/modules/services/x11/display-managers/slim.nix index af15e0df5e60..ad767e199a15 100644 --- a/modules/services/x11/display-managers/slim.nix +++ b/modules/services/x11/display-managers/slim.nix @@ -14,8 +14,8 @@ let xserver_arguments ${dmcfg.xserverArgs} sessions ${pkgs.lib.concatStringsSep "," (dmcfg.session.names ++ ["custom"])} login_cmd exec ${pkgs.stdenv.bash}/bin/sh ${dmcfg.session.script} "%session" - halt_cmd ${pkgs.upstart}/sbin/shutdown -h now - reboot_cmd ${pkgs.upstart}/sbin/shutdown -r now + halt_cmd ${config.system.build.upstart}/sbin/shutdown -h now + reboot_cmd ${config.system.build.upstart}/sbin/shutdown -r now ${if cfg.defaultUser != "" then "default_user " + cfg.defaultUser else ""} ${if cfg.hideCursor then "hidecursor true" else ""} ''; diff --git a/modules/system/activation/top-level.nix b/modules/system/activation/top-level.nix index 1e3f22c37adf..1f17702b408d 100644 --- a/modules/system/activation/top-level.nix +++ b/modules/system/activation/top-level.nix @@ -75,11 +75,11 @@ let ln -s ${config.system.activationScripts.script} $out/activate ln -s ${config.system.build.etc}/etc $out/etc ln -s ${config.system.path} $out/sw - ln -s ${pkgs.upstart} $out/upstart + ln -s ${config.system.build.upstart} $out/upstart echo "$kernelParams" > $out/kernel-params echo "$configurationName" > $out/configuration-name - echo "${toString pkgs.upstart.interfaceVersion}" > $out/upstart-interface-version + echo "${toString config.system.build.upstart.interfaceVersion}" > $out/upstart-interface-version mkdir $out/fine-tune childCount=0; @@ -113,7 +113,7 @@ let pkgs.gnugrep pkgs.findutils pkgs.diffutils - pkgs.upstart # for initctl + config.system.build.upstart # for initctl ]; # Boot loaders diff --git a/modules/system/boot/stage-2.nix b/modules/system/boot/stage-2.nix index 440ff70965f2..41c53c492f49 100644 --- a/modules/system/boot/stage-2.nix +++ b/modules/system/boot/stage-2.nix @@ -15,9 +15,10 @@ let }; - inherit (pkgs) substituteAll writeText coreutils utillinux udev upstart; + inherit (pkgs) substituteAll writeText coreutils utillinux udev; kernel = config.boot.kernelPackages.kernel; activateConfiguration = config.system.activationScripts.script; + upstart = config.system.build.upstart; # Path for Upstart jobs. Should be quite minimal. upstartPath = @@ -25,7 +26,7 @@ let pkgs.findutils pkgs.gnugrep pkgs.gnused - pkgs.upstart + upstart ]; bootStage2 = substituteAll { diff --git a/modules/system/upstart/upstart.nix b/modules/system/upstart/upstart.nix index 42ac98996731..a0f5b5802da1 100644 --- a/modules/system/upstart/upstart.nix +++ b/modules/system/upstart/upstart.nix @@ -4,6 +4,9 @@ with pkgs.lib; let + upstart = pkgs.upstart; + + # From a job description, generate an Upstart job file. makeJob = job: @@ -75,7 +78,7 @@ let jobs = - [pkgs.upstart] # for the built-in logd job + [ upstart ] # for the built-in logd job ++ map (job: job.upstartPkg) (attrValues config.jobs); @@ -278,6 +281,8 @@ in config = { + system.build.upstart = upstart; + environment.etc = [ { # The Upstart events defined above. source = "${jobsDir}/etc/event.d";