diff --git a/modules/installer/grub/grub-menu-builder.sh b/modules/installer/grub/grub-menu-builder.sh index ecb69ceb263..f23184b0a06 100644 --- a/modules/installer/grub/grub-menu-builder.sh +++ b/modules/installer/grub/grub-menu-builder.sh @@ -30,7 +30,7 @@ esac # the GRUB config file must be relative to the root of the /boot # filesystem. `$bootRoot' is the path to be prepended to paths under # /boot. -if [ "$(stat -f -c '%i' /)" = "$(stat -f -c '%i' /boot)" ]; then +if [ "$(stat -c '%D' /.)" = "$(stat -c '%D' /boot/.)" ]; then bootRoot=/boot copyKernels="@copyKernels@" # user can override in the NixOS config else diff --git a/modules/services/mail/postfix.nix b/modules/services/mail/postfix.nix index 939260632c9..03c77885d06 100644 --- a/modules/services/mail/postfix.nix +++ b/modules/services/mail/postfix.nix @@ -287,7 +287,15 @@ in daemonType = "none"; - respawn = false; + respawn = true; + + script = '' + while ${pkgs.procps}/bin/ps `${pkgs.coreutils}/bin/cat /var/postfix/queue/pid/master.pid` | + grep -q postfix + do + ${pkgs.coreutils}/bin/sleep 1m + done + ''; preStart = '' diff --git a/modules/services/misc/nix-daemon.nix b/modules/services/misc/nix-daemon.nix index a9a0bc70f1e..fcdcc8fb299 100644 --- a/modules/services/misc/nix-daemon.nix +++ b/modules/services/misc/nix-daemon.nix @@ -162,6 +162,10 @@ in internal = true; default = ""; merge = mergeStringOption; + example = '' + export NIX_TARGET_LOAD=$(( 3 * $(${pkgs.coreutils}/bin/nproc) / 2 )) + export NIX_MAX_PARALLELIZATION=$NIX_TARGET_LOAD + ''; description = " Environment variables used by Nix. "; diff --git a/modules/services/printing/cupsd.nix b/modules/services/printing/cupsd.nix index 40760ec8af5..0ac52fe1038 100644 --- a/modules/services/printing/cupsd.nix +++ b/modules/services/printing/cupsd.nix @@ -106,6 +106,11 @@ in services.dbus.packages = [cups]; + # cups uses libusb to talk to printers, and does not use the + # linux kernel driver. If the driver is not in a black list, it + # gets loaded, and then cups cannot access the printers. + boot.blacklistedKernelModules = [ "usblp" ]; + environment.etc = [ # CUPS expects the following files in its ServerRoot. { source = "${cups}/etc/cups/mime.convs"; @@ -122,15 +127,17 @@ in startOn = "started network-interfaces"; stopOn = "stopping network-interfaces"; + environment = { + # Cups scripts for printing (psto...) require awk, sed, grep, ... + PATH = "${config.system.path}/bin"; + }; + preStart = '' mkdir -m 0755 -p ${logDir} mkdir -m 0700 -p /var/cache/cups mkdir -m 0700 -p /var/spool/cups mkdir -m 0755 -p ${cfg.tempDir} - - # Make USB printers show up. - ${modprobe}/sbin/modprobe usblp || true ''; exec = "${cups}/sbin/cupsd -c ${pkgs.writeText "cupsd.conf" cfg.cupsdConf} -F"; diff --git a/modules/system/boot/stage-2-init.sh b/modules/system/boot/stage-2-init.sh index 201c539bb6b..aaf135fe51a 100644 --- a/modules/system/boot/stage-2-init.sh +++ b/modules/system/boot/stage-2-init.sh @@ -131,9 +131,15 @@ echo "running activation script..." @activateConfiguration@ "$systemConfig" -# Record the boot configuration. !!! Should this be a GC root? +# Record the boot configuration. if test -n "$systemConfig"; then ln -sfn "$systemConfig" /var/run/booted-system + + # Prevent the booted system form being garbage-collected + # If it weren't a gcroot, if we were running a different kernel, + # switched system, and garbage collected all, we could not load + # kernel modules anymore. + ln -sfn /var/run/booted-system /nix/var/nix/gcroots/booted-system fi diff --git a/modules/system/upstart/upstart.nix b/modules/system/upstart/upstart.nix index 3110f376eec..cb3975e694c 100644 --- a/modules/system/upstart/upstart.nix +++ b/modules/system/upstart/upstart.nix @@ -21,6 +21,7 @@ let makeJob = job: let + hasMain = job.script != "" || job.exec != ""; jobText = let log = "/var/log/upstart/${job.name}"; in @@ -77,12 +78,14 @@ let ${optionalString job.task "task"} ${optionalString (!job.task && job.respawn) "respawn"} - ${optionalString (job.preStop != "") '' + ${ # preStop is run only if there is exec or script. + # (upstart 0.6.5, job.c:562) + optionalString (job.preStop != "") (assert hasMain; '' pre-stop script exec >> ${log} 2>&1 ${job.preStop} end script - ''} + '')} ${optionalString (job.postStop != "") '' post-stop script diff --git a/tests/subversion.nix b/tests/subversion.nix index 5354a40452b..d43e369b437 100644 --- a/tests/subversion.nix +++ b/tests/subversion.nix @@ -19,7 +19,7 @@ let # To build the kernel with coverage instrumentation, we need a # special patch to make coverage data available under /proc. - kernel = pkgs.kernel.override (orig: { + linux = pkgs.linux.override (orig: { stdenv = cleanupBuildTree (keepBuildTree orig.stdenv); extraConfig = ''