Author: eelco
Date: Sun Mar 18 02:10:39 2012
New Revision: 33223
URL: https://nixos.org/websvn/nix/?rev=33223&sc=1
Log:
* Allow Upstart jobs to declare that they shouldn't be restarted by
switch-to-configuration. E.g. the X server shouldn't be restarted
because that kills all the X clients.
Modified:
nixos/trunk/modules/services/misc/disnix.nix
nixos/trunk/modules/services/system/dbus.nix
nixos/trunk/modules/services/x11/xserver.nix
nixos/trunk/modules/system/activation/switch-to-configuration.sh
nixos/trunk/modules/system/upstart/upstart.nix
nixos/trunk/modules/virtualisation/xen-dom0.nix
Modified: nixos/trunk/modules/services/misc/disnix.nix
==============================================================================
--- nixos/trunk/modules/services/misc/disnix.nix Sun Mar 18 01:53:35
2012 (r33222)
+++ nixos/trunk/modules/services/misc/disnix.nix Sun Mar 18 02:10:39
2012 (r33223)
@@ -126,6 +126,8 @@
+ optionalString config.services.tomcat.enable " and started tomcat"
+ optionalString config.services.svnserve.enable " and started
svnserve";
+ restartIfChanged = false;
+
script =
''
export
PATH=/var/run/current-system/sw/bin:/var/run/current-system/sw/sbin
Modified: nixos/trunk/modules/services/system/dbus.nix
==============================================================================
--- nixos/trunk/modules/services/system/dbus.nix Sun Mar 18 01:53:35
2012 (r33222)
+++ nixos/trunk/modules/services/system/dbus.nix Sun Mar 18 02:10:39
2012 (r33223)
@@ -117,7 +117,9 @@
jobs.dbus =
{ startOn = "started udev and started syslogd";
-
+
+ restartIfChanged = false;
+
path = [ pkgs.dbus_daemon pkgs.dbus_tools ];
preStart =
Modified: nixos/trunk/modules/services/x11/xserver.nix
==============================================================================
--- nixos/trunk/modules/services/x11/xserver.nix Sun Mar 18 01:53:35
2012 (r33222)
+++ nixos/trunk/modules/services/x11/xserver.nix Sun Mar 18 02:10:39
2012 (r33223)
@@ -392,7 +392,9 @@
};
jobs.xserver =
- { environment =
+ { restartIfChanged = false;
+
+ environment =
{ FONTCONFIG_FILE = "/etc/fonts/fonts.conf"; # !!! cleanup
XKB_BINDIR = "${xorg.xkbcomp}/bin"; # Needed for the Xkb extension.
TZ = config.time.timeZone;
Modified: nixos/trunk/modules/system/activation/switch-to-configuration.sh
==============================================================================
--- nixos/trunk/modules/system/activation/switch-to-configuration.sh Sun Mar
18 01:53:35 2012 (r33222)
+++ nixos/trunk/modules/system/activation/switch-to-configuration.sh Sun Mar
18 02:10:39 2012 (r33223)
@@ -108,14 +108,7 @@
status=$(status "$job")
if ! [[ "$status" =~ start/ ]]; then continue; fi
if [ "$(readlink -f "$newJobs/$job.conf")" = "$(readlink -f
"/var/run/upstart-jobs/$job")" ]; then continue; fi
- # Hack: don't restart the X server (that would kill all the clients).
- # And don't restart dbus, since that causes ConsoleKit to
- # forget about current sessions.
- # Idem for xendomains because we don't want to save/restore
- # Xen domains unless we have to.
- # TODO: Jobs should be able to declare that they should not be
- # auto-restarted.
- if echo "$job" | grep -q
"^xserver$\|^dbus$\|^disnix$\|^xendomains$\|^udevtrigger$"; then
+ if ! grep -q "^# RESTART-IF-CHANGED" "$newJobs/$job.conf"; then
echo "not restarting changed service ‘$job’"
continue
fi
Modified: nixos/trunk/modules/system/upstart/upstart.nix
==============================================================================
--- nixos/trunk/modules/system/upstart/upstart.nix Sun Mar 18 01:53:35
2012 (r33222)
+++ nixos/trunk/modules/system/upstart/upstart.nix Sun Mar 18 02:10:39
2012 (r33223)
@@ -82,6 +82,8 @@
${optionalString job.task "task"}
${optionalString (!job.task && job.respawn) "respawn"}
+ ${optionalString job.restartIfChanged "# RESTART-IF-CHANGED"}
+
${ # preStop is run only if there is exec or script.
# (upstart 0.6.5, job.c:562)
optionalString (job.preStop != "") (assert hasMain; ''
@@ -283,6 +285,15 @@
'';
};
+ restartIfChanged = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ Whether the job should be restarted if it has changed after a
+ NixOS configuration switch.
+ '';
+ };
+
task = mkOption {
type = types.bool;
default = false;
Modified: nixos/trunk/modules/virtualisation/xen-dom0.nix
==============================================================================
--- nixos/trunk/modules/virtualisation/xen-dom0.nix Sun Mar 18 01:53:35
2012 (r33222)
+++ nixos/trunk/modules/virtualisation/xen-dom0.nix Sun Mar 18 02:10:39
2012 (r33223)
@@ -140,6 +140,8 @@
stopOn = "starting shutdown and stopping xend";
+ restartIfChanged = false;
+
path = [ pkgs.xen ];
environment.XENDOM_CONFIG = "${xen}/etc/sysconfig/xendomains";
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits