Merge branch 'master' of github.com:NixOS/nixos into systemd

Conflicts:
	modules/services/hardware/udev.nix
This commit is contained in:
Eelco Dolstra 2012-06-28 14:19:38 -04:00
commit bf15293b1e
9 changed files with 80 additions and 58 deletions

View File

@ -28,6 +28,7 @@
<arg choice='plain'><option>pull</option></arg> <arg choice='plain'><option>pull</option></arg>
</group> </group>
<sbr /> <sbr />
<arg><option>--upgrade</option></arg>
<arg><option>--install-grub</option></arg> <arg><option>--install-grub</option></arg>
<arg><option>--no-pull</option></arg> <arg><option>--no-pull</option></arg>
<arg><option>--no-build-nix</option></arg> <arg><option>--no-build-nix</option></arg>
@ -173,12 +174,11 @@ $ ./result/bin/run-*-vm
<varlistentry> <varlistentry>
<term><option>pull</option></term> <term><option>pull</option></term>
<listitem> <listitem>
<para>This operation merely fetches the latest manifest in the <para>This operation fetches the latest manifest in the Nixpkgs
Nixpkgs channel to speed up subsequent channel to speed up subsequent <command>nix-env</command>
<command>nix-env</command> operations. This is useful if you operations. This is useful if you are not using
are not using <command>nix-channel</command> but still want to <command>nix-channel</command> but still want to use pre-built
use pre-built binary packages. It doesnt reconfigure the binary packages. It doesnt reconfigure the system</para>
system at all.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -196,6 +196,14 @@ $ ./result/bin/run-*-vm
<variablelist> <variablelist>
<varlistentry>
<term><option>--upgrade</option></term>
<listitem>
<para>Fetch the latest version of NixOS from the NixOS
channel.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><option>--install-grub</option></term> <term><option>--install-grub</option></term>
<listitem> <listitem>
@ -206,21 +214,6 @@ $ ./result/bin/run-*-vm
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><option>--no-pull</option></term>
<listitem>
<para>Normally, <command>nixos-rebuild</command> calls
<command>nix-pull</command> to obtain the set of available
pre-built binaries in the Nixpkgs channel. This option causes
the call to <command>nix-pull</command> to be skipped. Note
that the result of previous invocations of
<command>nix-pull</command> may still be available in
<filename>/nix/var/nix/manifests</filename>, so to disable the
use of pre-built binaries, you should clear that directory in
addition to using <option>--no-pull</option>.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><option>--no-build-nix</option></term> <term><option>--no-build-nix</option></term>
<listitem> <listitem>
@ -236,10 +229,9 @@ $ ./result/bin/run-*-vm
<varlistentry> <varlistentry>
<term><option>--fast</option></term> <term><option>--fast</option></term>
<listitem> <listitem>
<para>Equivalent to <option>--no-pull</option> <para>Equivalent to <option>--no-build-nix</option>
<option>--no-build-nix</option> <option>--show-trace</option>. <option>--show-trace</option>. This option is useful if you
This option is useful if you call call <command>nixos-rebuild</command> frequently (e.g. if youre
<command>nixos-rebuild</command> frequently (e.g. if youre
hacking on a NixOS module).</para> hacking on a NixOS module).</para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@ -205,7 +205,9 @@ in
else else
[ config.boot.kernelPackages.aufs ]; [ config.boot.kernelPackages.aufs ];
boot.initrd.kernelModules = [ "aufs" "squashfs" "iso9660" "loop" ]; boot.initrd.availableKernelModules = [ "aufs" "squashfs" "iso9660" ];
boot.initrd.kernelModules = [ "loop" ];
boot.kernelModules = pkgs.stdenv.lib.optional config.isoImage.makeEfiBootable "efivars"; boot.kernelModules = pkgs.stdenv.lib.optional config.isoImage.makeEfiBootable "efivars";

View File

@ -158,9 +158,6 @@ in
services.openssh.enable = true; services.openssh.enable = true;
jobs.openssh.startOn = pkgs.lib.mkOverrideTemplate 50 {} ""; jobs.openssh.startOn = pkgs.lib.mkOverrideTemplate 50 {} "";
# To have a nicer initrd, even though the initrd can't mount an nfsroot now
boot.initrd.withExtraTools = true;
# To be able to use the systemTarball to catch troubles. # To be able to use the systemTarball to catch troubles.
boot.crashDump = { boot.crashDump = {
enable = true; enable = true;

View File

@ -22,6 +22,7 @@ The operation is one of the following:
Options: Options:
--upgrade fetch the latest version of NixOS before rebuilding
--install-grub (re-)install the Grub bootloader --install-grub (re-)install the Grub bootloader
--pull do a nix-pull to get the latest NixOS channel --pull do a nix-pull to get the latest NixOS channel
manifest manifest
@ -51,6 +52,7 @@ action=
pullManifest= pullManifest=
buildNix=1 buildNix=1
rollback= rollback=
upgrade=
while test "$#" -gt 0; do while test "$#" -gt 0; do
i="$1"; shift 1 i="$1"; shift 1
@ -73,6 +75,9 @@ while test "$#" -gt 0; do
--rollback) --rollback)
rollback=1 rollback=1
;; ;;
--upgrade)
upgrade=1
;;
--show-trace|--no-build-hook|--keep-failed|-K|--keep-going|-k|--verbose|-v|--fallback) --show-trace|--no-build-hook|--keep-failed|-K|--keep-going|-k|--verbose|-v|--fallback)
extraBuildFlags="$extraBuildFlags $i" extraBuildFlags="$extraBuildFlags $i"
;; ;;
@ -120,9 +125,13 @@ fi
# Pull the manifests defined in the configuration (the "manifests" # Pull the manifests defined in the configuration (the "manifests"
# attribute). Wonderfully hacky. # attribute). Wonderfully hacky.
if [ -n "$pullManifest" -o "$action" = pull ]; then if [ -n "$pullManifest" -o "$action" = pull ]; then
set -o pipefail
manifests=$(nix-instantiate --eval-only --xml --strict '<nixos>' -A manifests \ manifests=$(nix-instantiate --eval-only --xml --strict '<nixos>' -A manifests \
| grep '<string' | sed 's^.*"\(.*\)".*^\1^g') | grep '<string' | sed 's^.*"\(.*\)".*^\1^g')
set -o nopipefail
if [ $? -ne 0 ]; then exit 1; fi
mkdir -p /nix/var/nix/channel-cache mkdir -p /nix/var/nix/channel-cache
for i in $manifests; do for i in $manifests; do
NIX_DOWNLOAD_CACHE=/nix/var/nix/channel-cache nix-pull $i || true NIX_DOWNLOAD_CACHE=/nix/var/nix/channel-cache nix-pull $i || true
@ -132,10 +141,16 @@ fi
if [ "$action" = pull ]; then exit 0; fi if [ "$action" = pull ]; then exit 0; fi
# If --upgrade is given, run nix-channel --update nixos.
if [ -n "$upgrade" ]; then
nix-channel --update nixos
fi
# First build Nix, since NixOS may require a newer version than the # First build Nix, since NixOS may require a newer version than the
# current one. Of course, the same goes for Nixpkgs, but Nixpkgs is # current one. Of course, the same goes for Nixpkgs, but Nixpkgs is
# more conservative. # more conservative.
if test -n "$buildNix"; then if [ -n "$buildNix" ]; then
echo "building Nix..." >&2 echo "building Nix..." >&2
if ! nix-build '<nixos>' -A config.environment.nix -o $tmpDir/nix $extraBuildFlags > /dev/null; then if ! nix-build '<nixos>' -A config.environment.nix -o $tmpDir/nix $extraBuildFlags > /dev/null; then
if ! nix-build '<nixos>' -A nixFallback -o $tmpDir/nix $extraBuildFlags > /dev/null; then if ! nix-build '<nixos>' -A nixFallback -o $tmpDir/nix $extraBuildFlags > /dev/null; then

View File

@ -51,7 +51,7 @@ let
--replace \"/bin/mount \"${pkgs.utillinux}/bin/mount --replace \"/bin/mount \"${pkgs.utillinux}/bin/mount
done done
echo -n "Checking that all programs called by relative paths in udev rules exist in ${udev}/lib/udev ... " echo -n "Checking that all programs called by relative paths in udev rules exist in ${udev}/lib/udev... "
import_progs=$(grep 'IMPORT{program}="[^/$]' $out/* | import_progs=$(grep 'IMPORT{program}="[^/$]' $out/* |
sed -e 's/.*IMPORT{program}="\([^ "]*\)[ "].*/\1/' | uniq) sed -e 's/.*IMPORT{program}="\([^ "]*\)[ "].*/\1/' | uniq)
run_progs=$(grep -v '^[[:space:]]*#' $out/* | grep 'RUN+="[^/$]' | run_progs=$(grep -v '^[[:space:]]*#' $out/* | grep 'RUN+="[^/$]' |
@ -65,8 +65,8 @@ let
done done
echo "OK" echo "OK"
echo -n "Checking that all programs called by absolute paths in udev rules exist ... " echo -n "Checking that all programs called by absolute paths in udev rules exist... "
import_progs=$(grep 'IMPORT{program}="/' $out/* | import_progs=$(grep 'IMPORT{program}="\/' $out/* |
sed -e 's/.*IMPORT{program}="\([^ "]*\)[ "].*/\1/' | uniq) sed -e 's/.*IMPORT{program}="\([^ "]*\)[ "].*/\1/' | uniq)
run_progs=$(grep -v '^[[:space:]]*#' $out/* | grep 'RUN+="/' | run_progs=$(grep -v '^[[:space:]]*#' $out/* | grep 'RUN+="/' |
sed -e 's/.*RUN+="\([^ "]*\)[ "].*/\1/' | uniq) sed -e 's/.*RUN+="\([^ "]*\)[ "].*/\1/' | uniq)

View File

@ -11,7 +11,7 @@ let
# available as a function. # available as a function.
if ! test -e ${device}; then if ! test -e ${device}; then
echo -n "waiting 10 seconds for device ${device} to appear..." echo -n "waiting 10 seconds for device ${device} to appear..."
for ((try = 0; try < 10; try++)); do for try in $(seq 10); do
sleep 1 sleep 1
if test -e ${device}; then break; fi if test -e ${device}; then break; fi
echo -n . echo -n .

View File

@ -173,21 +173,28 @@ onACPower() {
# Check the specified file system, if appropriate. # Check the specified file system, if appropriate.
checkFS() { checkFS() {
# Only check block devices. local device="$1"
if ! test -b "$device"; then return 0; fi local fsType="$2"
FSTYPE=$(blkid -o value -s TYPE "$device" || true) # Only check block devices.
if [ ! -b "$device" ]; then return 0; fi
# Don't check ROM filesystems. # Don't check ROM filesystems.
if test "$FSTYPE" = iso9660 -o "$FSTYPE" = udf; then return 0; fi if [ "$fsType" = iso9660 -o "$fsType" = udf ]; then return 0; fi
# If we couldn't figure out the FS type, then skip fsck.
if [ "$fsType" = auto ]; then
echo 'cannot check filesystem with type "auto"!'
return 0
fi
# Optionally, skip fsck on journaling filesystems. This option is # Optionally, skip fsck on journaling filesystems. This option is
# a hack - it's mostly because e2fsck on ext3 takes much longer to # a hack - it's mostly because e2fsck on ext3 takes much longer to
# recover the journal than the ext3 implementation in the kernel # recover the journal than the ext3 implementation in the kernel
# does (minutes versus seconds). # does (minutes versus seconds).
if test -z "@checkJournalingFS@" -a \ if test -z "@checkJournalingFS@" -a \
\( "$FSTYPE" = ext3 -o "$FSTYPE" = ext4 -o "$FSTYPE" = reiserfs \ \( "$fsType" = ext3 -o "$fsType" = ext4 -o "$fsType" = reiserfs \
-o "$FSTYPE" = xfs -o "$FSTYPE" = jfs \) -o "$fsType" = xfs -o "$fsType" = jfs \)
then then
return 0 return 0
fi fi
@ -199,7 +206,9 @@ checkFS() {
return 0 return 0
fi fi
FSTAB_FILE="/etc/mtab" fsck -V -C -a "$device" echo "checking $device..."
fsck -V -a "$device"
fsckResult=$? fsckResult=$?
if test $(($fsckResult | 2)) = $fsckResult; then if test $(($fsckResult | 2)) = $fsckResult; then
@ -229,7 +238,16 @@ mountFS() {
local options="$3" local options="$3"
local fsType="$4" local fsType="$4"
checkFS "$device" if [ "$fsType" = auto ]; then
fsType=$(blkid -o value -s TYPE "$device")
if [ -z "$fsType" ]; then fsType=auto; fi
fi
echo "$device /mnt-root$mountPoint $fsType $options" >> /etc/fstab
checkFS "$device" "$fsType"
echo "mounting $device on $mountPoint..."
mkdir -p "/mnt-root$mountPoint" || true mkdir -p "/mnt-root$mountPoint" || true
@ -239,7 +257,7 @@ mountFS() {
if [ "$fsType" = "nfs" ]; then if [ "$fsType" = "nfs" ]; then
nfsmount "$device" "/mnt-root$mountPoint" && break nfsmount "$device" "/mnt-root$mountPoint" && break
else else
mount -t "$fsType" -o "$options" "$device" "/mnt-root$mountPoint" && break mount "/mnt-root$mountPoint" && break
fi fi
if [ "$fsType" != cifs -o "$n" -ge 10 ]; then fail; break; fi if [ "$fsType" != cifs -o "$n" -ge 10 ]; then fail; break; fi
echo "retrying..." echo "retrying..."
@ -300,8 +318,6 @@ while read -u 3 mountPoint; do
# doing something with $device right now. # doing something with $device right now.
udevadm settle || true udevadm settle || true
echo "mounting $device on $mountPoint..."
mountFS "$device" "$mountPoint" "$options" "$fsType" mountFS "$device" "$mountPoint" "$options" "$fsType"
done done

View File

@ -72,7 +72,7 @@ done
# More special file systems, initialise required directories. # More special file systems, initialise required directories.
mkdir -m 0777 /dev/shm mkdir -m 0755 /dev/shm
mount -t tmpfs -o "rw,nosuid,nodev,size=@devShmSize@" tmpfs /dev/shm mount -t tmpfs -o "rw,nosuid,nodev,size=@devShmSize@" tmpfs /dev/shm
mkdir -m 0755 -p /dev/pts mkdir -m 0755 -p /dev/pts
[ -e /proc/bus/usb ] && mount -t usbfs none /proc/bus/usb # UML doesn't have USB by default [ -e /proc/bus/usb ] && mount -t usbfs none /proc/bus/usb # UML doesn't have USB by default

View File

@ -83,7 +83,7 @@ with pkgs.lib;
# Force udev to exit to prevent random "Device or resource busy # Force udev to exit to prevent random "Device or resource busy
# while trying to open /dev/xvda" errors from fsck. # while trying to open /dev/xvda" errors from fsck.
udevadm control --exit || true udevadm control --exit || true
kill -9 -- -1 kill -9 -1
''; '';
# Mount all formatted ephemeral disks and activate all swap devices. # Mount all formatted ephemeral disks and activate all swap devices.