summary refs log tree commit diff
path: root/nixos/modules/virtualisation/amazon-image.nix
diff options
context:
space:
mode:
authorcransom user <cransom@deployer1.dev.lkt.is>2016-02-02 01:40:41 +0000
committercransom user <cransom@deployer1.dev.lkt.is>2016-02-02 01:40:41 +0000
commitf10bead8fd068f2cb82cbdc1a938a67bd967974c (patch)
treedd969419336d24a1a7eb83b51a0826751df599e4 /nixos/modules/virtualisation/amazon-image.nix
parent58046b7f03194140e5dee11338416d3f9c25bcd4 (diff)
downloadnixlib-f10bead8fd068f2cb82cbdc1a938a67bd967974c.tar
nixlib-f10bead8fd068f2cb82cbdc1a938a67bd967974c.tar.gz
nixlib-f10bead8fd068f2cb82cbdc1a938a67bd967974c.tar.bz2
nixlib-f10bead8fd068f2cb82cbdc1a938a67bd967974c.tar.lz
nixlib-f10bead8fd068f2cb82cbdc1a938a67bd967974c.tar.xz
nixlib-f10bead8fd068f2cb82cbdc1a938a67bd967974c.tar.zst
nixlib-f10bead8fd068f2cb82cbdc1a938a67bd967974c.zip
Do not relocate /nix and /tmp to small disks on AWS
The default behavior with an m3.medium instance is to relocate
/nix and /tmp to /disk0 because an assumption is made that any
ephemeral disk is larger than the root volume.  Rather than make
that assumption, add a check to see if the disk is larger, and
only then relocate /nix and /tmp.

This addresses https://github.com/NixOS/nixpkgs/issues/12613
Diffstat (limited to 'nixos/modules/virtualisation/amazon-image.nix')
-rw-r--r--nixos/modules/virtualisation/amazon-image.nix6
1 files changed, 5 insertions, 1 deletions
diff --git a/nixos/modules/virtualisation/amazon-image.nix b/nixos/modules/virtualisation/amazon-image.nix
index 7ccc9df740e5..7cb37bbc4a76 100644
--- a/nixos/modules/virtualisation/amazon-image.nix
+++ b/nixos/modules/virtualisation/amazon-image.nix
@@ -68,7 +68,11 @@ let cfg = config.ec2; in
                 diskNr=$((diskNr + 1))
                 echo "mounting $device on $mp..."
                 if mountFS "$device" "$mp" "" ext3; then
-                    if [ -z "$diskForUnionfs" ]; then diskForUnionfs="$mp"; fi
+                    if [ -z "$diskForUnionfs" -a \
+                         $(lsblk -bno size $device) -gt $(lsblk -bno size /dev/xvda1)
+                       ]; then
+                       diskForUnionfs="$mp";
+                    fi
                 fi
             else
                 echo "skipping unknown device type $device"