* 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:
parent
8179e5213f
commit
9460a30851
@ -127,6 +127,9 @@ fi
|
|||||||
if test -n "$debug1devices"; then fail; fi
|
if test -n "$debug1devices"; then fail; fi
|
||||||
|
|
||||||
|
|
||||||
|
@postDeviceCommands@
|
||||||
|
|
||||||
|
|
||||||
# Return true if the machine is on AC power, or if we can't determine
|
# Return true if the machine is on AC power, or if we can't determine
|
||||||
# whether it's on AC power.
|
# whether it's on AC power.
|
||||||
onACPower() {
|
onACPower() {
|
||||||
@ -223,6 +226,9 @@ for ((n = 0; n < ${#mountPoints[*]}; n++)); do
|
|||||||
case $device in
|
case $device in
|
||||||
/dev/*)
|
/dev/*)
|
||||||
;;
|
;;
|
||||||
|
//*)
|
||||||
|
# Don't touch SMB/CIFS paths.
|
||||||
|
;;
|
||||||
/*)
|
/*)
|
||||||
device=/mnt-root$device
|
device=/mnt-root$device
|
||||||
;;
|
;;
|
||||||
|
@ -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 {
|
boot.initrd.postMountCommands = mkOption {
|
||||||
default = "";
|
default = "";
|
||||||
merge = pkgs.lib.mergeStringOption;
|
merge = pkgs.lib.mergeStringOption;
|
||||||
description = ''
|
description = ''
|
||||||
Shell commands to be executed immediately after the stage 1
|
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) isLiveCD resumeDevice;
|
||||||
|
|
||||||
inherit (config.boot.initrd) checkJournalingFS postMountCommands;
|
inherit (config.boot.initrd) checkJournalingFS
|
||||||
|
postDeviceCommands postMountCommands;
|
||||||
|
|
||||||
# !!! copy&pasted from upstart-jobs/filesystems.nix.
|
# !!! copy&pasted from upstart-jobs/filesystems.nix.
|
||||||
mountPoints =
|
mountPoints =
|
||||||
|
@ -16,25 +16,30 @@
|
|||||||
boot.initrd.extraKernelModules =
|
boot.initrd.extraKernelModules =
|
||||||
["cifs" "virtio_net" "virtio_pci" "virtio_blk" "virtio_balloon" "nls_utf8"];
|
["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 =
|
fileSystems =
|
||||||
[ { mountPoint = "/";
|
[ { mountPoint = "/";
|
||||||
device = "/dev/vda";
|
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
|
# Starting DHCP brings down eth0, which kills the connection to the
|
||||||
# host filesystem and thus deadlocks the system.
|
# host filesystem and thus deadlocks the system.
|
||||||
networking.useDHCP = false;
|
networking.useDHCP = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user