* Use the fileSystems option to mount the host filesystem. Also, it

seems that mount.cifs isn't actually needed (anymore?).

svn path=/nixos/branches/modular-nixos/; revision=16000
This commit is contained in:
Eelco Dolstra 2009-06-18 16:47:00 +00:00
parent 8179e5213f
commit 9460a30851
3 changed files with 37 additions and 15 deletions

View File

@ -127,6 +127,9 @@ fi
if test -n "$debug1devices"; then fail; fi
@postDeviceCommands@
# Return true if the machine is on AC power, or if we can't determine
# whether it's on AC power.
onACPower() {
@ -223,6 +226,9 @@ for ((n = 0; n < ${#mountPoints[*]}; n++)); do
case $device in
/dev/*)
;;
//*)
# Don't touch SMB/CIFS paths.
;;
/*)
device=/mnt-root$device
;;

View File

@ -62,12 +62,22 @@ let
'';
};
boot.initrd.postDeviceCommands = mkOption {
default = "";
merge = pkgs.lib.mergeStringOption;
description = ''
Shell commands to be executed immediately after stage 1 of the
boot has loaded kernel modules and created device nodes in
/dev.
'';
};
boot.initrd.postMountCommands = mkOption {
default = "";
merge = pkgs.lib.mergeStringOption;
description = ''
Shell commands to be executed immediately after the stage 1
filesystems has been mounted.
filesystems have been mounted.
'';
};
@ -232,7 +242,8 @@ let
inherit (config.boot) isLiveCD resumeDevice;
inherit (config.boot.initrd) checkJournalingFS postMountCommands;
inherit (config.boot.initrd) checkJournalingFS
postDeviceCommands postMountCommands;
# !!! copy&pasted from upstart-jobs/filesystems.nix.
mountPoints =

View File

@ -16,25 +16,30 @@
boot.initrd.extraKernelModules =
["cifs" "virtio_net" "virtio_pci" "virtio_blk" "virtio_balloon" "nls_utf8"];
boot.initrd.postDeviceCommands =
''
ipconfig 10.0.2.15:::::eth0:none
'';
# Mount the host filesystem via CIFS, and bind-mount the Nix store
# of the host into our own filesystem.
fileSystems =
[ { mountPoint = "/";
device = "/dev/vda";
}
{ mountPoint = "/hostfs";
device = "//10.0.2.4/qemu";
fsType = "cifs";
options = "guest,username=nobody";
neededForBoot = true;
}
{ mountPoint = "/nix/store";
device = "/hostfs/nix/store";
options = "bind";
neededForBoot = true;
}
];
# Mount the host filesystem and bind-mount its Nix store into our
# own root FS.
boot.initrd.postMountCommands =
''
ipconfig 10.0.2.15:::::eth0:none
mkdir /hostfs
${pkgs.vmTools.mountCifs}/bin/mount.cifs //10.0.2.4/qemu /hostfs -o guest,username=nobody
mkdir -p $targetRoot/nix/store
mount --bind /hostfs/nix/store $targetRoot/nix/store
'';
# Starting DHCP brings down eth0, which kills the connection to the
# host filesystem and thus deadlocks the system.
networking.useDHCP = false;