* In the network-interfaces task, emit an ip-up event if there is a
statically configured interface (i.e. we're not running dhclient). Otherwise the ntpd job won't be triggered. * Use the "-n" flag of "initctl emit" to send the event asynchronously. svn path=/nixos/branches/upstart-0.6/; revision=18227
This commit is contained in:
parent
4b2ff53ec6
commit
d545d08461
@ -191,7 +191,7 @@ in
|
|||||||
${udev}/sbin/udevadm trigger
|
${udev}/sbin/udevadm trigger
|
||||||
${udev}/sbin/udevadm settle # wait for udev to finish
|
${udev}/sbin/udevadm settle # wait for udev to finish
|
||||||
|
|
||||||
initctl emit new-devices
|
initctl emit -n new-devices
|
||||||
'';
|
'';
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -28,11 +28,11 @@ let
|
|||||||
# it"), so we silently lose time synchronisation.
|
# it"), so we silently lose time synchronisation.
|
||||||
${config.system.build.upstart}/sbin/initctl stop ntpd
|
${config.system.build.upstart}/sbin/initctl stop ntpd
|
||||||
|
|
||||||
${config.system.build.upstart}/sbin/initctl emit ip-up
|
${config.system.build.upstart}/sbin/initctl emit -n ip-up
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$reason" = EXPIRE -o "$reason" = RELEASE; then
|
if test "$reason" = EXPIRE -o "$reason" = RELEASE; then
|
||||||
${config.system.build.upstart}/sbin/initctl emit ip-down
|
${config.system.build.upstart}/sbin/initctl emit -n ip-down
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ in
|
|||||||
chown ${ntpUser} ${stateDir}
|
chown ${ntpUser} ${stateDir}
|
||||||
|
|
||||||
# Needed to run ntpd as an unprivileged user.
|
# Needed to run ntpd as an unprivileged user.
|
||||||
${modprobe}/sbin/modprobe capability || true
|
${modprobe}/sbin/modprobe --quiet capability
|
||||||
|
|
||||||
# !!! This can hang indefinitely if the network is down or
|
# !!! This can hang indefinitely if the network is down or
|
||||||
# the servers are unreachable. This is particularly bad
|
# the servers are unreachable. This is particularly bad
|
||||||
|
@ -61,7 +61,7 @@ with pkgs.lib;
|
|||||||
echo "<<< MAINTENANCE SHELL >>>"
|
echo "<<< MAINTENANCE SHELL >>>"
|
||||||
echo ""
|
echo ""
|
||||||
while ! ${pkgs.bash}/bin/bash --login; do true; done
|
while ! ${pkgs.bash}/bin/bash --login; do true; done
|
||||||
initctl emit startup
|
initctl emit -n startup
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
# make them appear in /dev.
|
# make them appear in /dev.
|
||||||
${pkgs.lvm2}/sbin/vgchange --available y
|
${pkgs.lvm2}/sbin/vgchange --available y
|
||||||
|
|
||||||
initctl emit new-devices
|
initctl emit -n new-devices
|
||||||
'';
|
'';
|
||||||
|
|
||||||
task = true;
|
task = true;
|
||||||
|
@ -178,6 +178,11 @@ in
|
|||||||
|
|
||||||
# Run any user-specified commands.
|
# Run any user-specified commands.
|
||||||
${pkgs.stdenv.shell} ${pkgs.writeText "local-net-cmds" cfg.localCommands} || true
|
${pkgs.stdenv.shell} ${pkgs.writeText "local-net-cmds" cfg.localCommands} || true
|
||||||
|
|
||||||
|
# Emit the ip-up event (e.g. to start ntpd).
|
||||||
|
${optionalString (cfg.interfaces != []) ''
|
||||||
|
initctl emit -n ip-up
|
||||||
|
''}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postStop =
|
postStop =
|
||||||
|
@ -31,7 +31,7 @@ in
|
|||||||
# Activate each device found.
|
# Activate each device found.
|
||||||
${mdadm}/sbin/mdadm --assemble -c ${tempConf} --scan
|
${mdadm}/sbin/mdadm --assemble -c ${tempConf} --scan
|
||||||
|
|
||||||
initctl emit new-devices
|
initctl emit -n new-devices
|
||||||
'';
|
'';
|
||||||
|
|
||||||
task = true;
|
task = true;
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
|
|
||||||
{config, pkgs, ...}:
|
{config, pkgs, ...}:
|
||||||
|
|
||||||
|
with pkgs.lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
vmName = config.networking.hostName;
|
vmName = config.networking.hostName;
|
||||||
@ -16,7 +18,7 @@ let
|
|||||||
options = {
|
options = {
|
||||||
|
|
||||||
virtualisation.diskImage =
|
virtualisation.diskImage =
|
||||||
pkgs.lib.mkOption {
|
mkOption {
|
||||||
default = "./${vmName}.qcow2";
|
default = "./${vmName}.qcow2";
|
||||||
description =
|
description =
|
||||||
''
|
''
|
||||||
@ -90,7 +92,7 @@ in
|
|||||||
# where the regular value for the `fileSystems' attribute should be
|
# where the regular value for the `fileSystems' attribute should be
|
||||||
# disregarded for the purpose of building a VM test image (since
|
# disregarded for the purpose of building a VM test image (since
|
||||||
# those filesystems don't exist in the VM).
|
# those filesystems don't exist in the VM).
|
||||||
fileSystems = pkgs.lib.mkOverride 50 {}
|
fileSystems = mkOverride 50 {}
|
||||||
[ { mountPoint = "/";
|
[ { mountPoint = "/";
|
||||||
device = "/dev/vda";
|
device = "/dev/vda";
|
||||||
}
|
}
|
||||||
@ -121,6 +123,11 @@ in
|
|||||||
|
|
||||||
networking.nameservers = [ "10.0.2.3" ];
|
networking.nameservers = [ "10.0.2.3" ];
|
||||||
|
|
||||||
|
networking.interfaces = singleton
|
||||||
|
{ name = "eth0";
|
||||||
|
ipAddress = "10.0.2.15";
|
||||||
|
};
|
||||||
|
|
||||||
system.build.vm = pkgs.runCommand "nixos-vm" {}
|
system.build.vm = pkgs.runCommand "nixos-vm" {}
|
||||||
''
|
''
|
||||||
ensureDir $out/bin
|
ensureDir $out/bin
|
||||||
@ -137,11 +144,11 @@ in
|
|||||||
|
|
||||||
# When building a regular system configuration, override whatever
|
# When building a regular system configuration, override whatever
|
||||||
# video driver the host uses.
|
# video driver the host uses.
|
||||||
services.xserver.videoDriver = pkgs.lib.mkOverride 50 {} null;
|
services.xserver.videoDriver = mkOverride 50 {} null;
|
||||||
services.xserver.videoDrivers = pkgs.lib.mkOverride 50 {} [ "cirrus" "vesa" ];
|
services.xserver.videoDrivers = mkOverride 50 {} [ "cirrus" "vesa" ];
|
||||||
services.xserver.defaultDepth = pkgs.lib.mkOverride 50 {} 0;
|
services.xserver.defaultDepth = mkOverride 50 {} 0;
|
||||||
services.xserver.resolutions = pkgs.lib.mkOverride 50 {} [];
|
services.xserver.resolutions = mkOverride 50 {} [];
|
||||||
|
|
||||||
# Wireless won't work in the VM.
|
# Wireless won't work in the VM.
|
||||||
networking.enableWLAN = pkgs.lib.mkOverride 50 {} false;
|
networking.enableWLAN = mkOverride 50 {} false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user