Use make-disk-image.nix for VirtualBox images

This commit is contained in:
Eelco Dolstra 2015-09-28 14:31:19 +02:00
parent f596f0323f
commit b3347287be
2 changed files with 34 additions and 84 deletions

View file

@ -19,6 +19,9 @@
# /etc/nixos/configuration.nix.
configFile ? null
, # Shell code executed after the VM has finished.
postVM ? ""
}:
with lib;
@ -35,6 +38,7 @@ pkgs.vmTools.runInLinuxVM (
buildInputs = [ pkgs.utillinux pkgs.perl pkgs.e2fsprogs pkgs.parted ];
exportReferencesGraph =
[ "closure" config.system.build.toplevel ];
inherit postVM;
}
''
${if partitioned then ''
@ -68,6 +72,7 @@ pkgs.vmTools.runInLinuxVM (
mkdir -p /mnt/nix/store
echo "copying everything (will take a while)..."
set -f
cp -prd $storePaths /mnt/nix/store/
# Register the paths in the Nix database.
@ -94,6 +99,7 @@ pkgs.vmTools.runInLinuxVM (
# Generate the GRUB menu.
ln -s vda /dev/xvda
ln -s vda /dev/sda
chroot /mnt ${config.system.build.toplevel}/bin/switch-to-configuration boot
umount /mnt/proc /mnt/dev /mnt/sys