3
0
Fork 0
forked from mirrors/nixpkgs

Increase size of GCE image. Use disk.raw as name inside tar.gz, as this is compulsory.

This commit is contained in:
Rob Vermaas 2014-03-21 14:55:42 +01:00
parent f3f6f04c7d
commit af6c571a7e

View file

@ -1,7 +1,9 @@
{ config, pkgs, ... }:
with pkgs.lib;
let
diskSize = "200G";
in
{
imports = [ ../profiles/headless.nix ../profiles/qemu-guest.nix ];
@ -12,7 +14,7 @@ with pkgs.lib;
''
mkdir $out
diskImage=$out/$diskImageBase
truncate $diskImage --size 10G
truncate $diskImage --size ${diskSize}
mv closure xchg/
'';
@ -20,8 +22,9 @@ with pkgs.lib;
''
PATH=$PATH:${pkgs.gnutar}/bin:${pkgs.gzip}/bin
pushd $out
tar -Szcf $diskImageBase.tar.gz $diskImageBase
rm $out/$diskImageBase
mv $diskImageBase disk.raw
tar -Szcf $diskImageBase.tar.gz disk.raw
rm $out/disk.raw
popd
'';
diskImageBase = "nixos-${config.system.nixosVersion}-${pkgs.stdenv.system}.raw";
@ -32,7 +35,7 @@ with pkgs.lib;
''
# Create partition table
${pkgs.parted}/sbin/parted /dev/vda mklabel msdos
${pkgs.parted}/sbin/parted /dev/vda mkpart primary ext4 1 10G
${pkgs.parted}/sbin/parted /dev/vda mkpart primary ext4 1 ${diskSize}
${pkgs.parted}/sbin/parted /dev/vda print
. /sys/class/block/vda1/uevent
mknod /dev/vda1 b $MAJOR $MINOR