From 72ec884cc65c2bfd799376a80868994f24621b1b Mon Sep 17 00:00:00 2001 From: Clemens Fruhwirth Date: Wed, 22 Mar 2017 17:17:25 +0100 Subject: [PATCH] Make GCE image as small as possible and incorporate partition growing when users of nixops specified a larger root disk via deployment.gce.rootDiskSize 1GB is the smallest possible size as GCP doesn't support fractions of GB for RAW images, see https://cloud.google.com/compute/docs/images/import-existing-image#requirements --- nixos/modules/virtualisation/google-compute-image.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/nixos/modules/virtualisation/google-compute-image.nix b/nixos/modules/virtualisation/google-compute-image.nix index a3dd3bd55d1..5673d55b339 100644 --- a/nixos/modules/virtualisation/google-compute-image.nix +++ b/nixos/modules/virtualisation/google-compute-image.nix @@ -2,10 +2,10 @@ with lib; let - diskSize = "100G"; + diskSize = "1G"; in { - imports = [ ../profiles/headless.nix ../profiles/qemu-guest.nix ]; + imports = [ ../profiles/headless.nix ../profiles/qemu-guest.nix ./grow-partition.nix ]; # https://cloud.google.com/compute/docs/tutorials/building-images networking.firewall.enable = mkDefault false; @@ -94,7 +94,10 @@ in '' ); - fileSystems."/".label = "nixos"; + fileSystems."/" = { + device = "/dev/disk/by-label/nixos"; + autoResize = true; + }; boot.kernelParams = [ "console=ttyS0" "panic=1" "boot.panic_on_fail" ]; boot.initrd.kernelModules = [ "virtio_scsi" ];