git.iko.soy/typeable/nixpkgs
on master help sign in
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

commitf10bead8fd068f2cb82cbdc1a938a67bd967974c authorcransom user <cransom@deployer1.dev.lkt.is> dateTue 2 Feb 2016, 01:40 (11 years ago) parent58046b7
1 file changed+5−1
nixos/modules/virtualisation/amazon-image.nix+5−1
nixos/modules/virtualisation/amazon-image.nix+5−1
@@ -68,7 +68,11 @@ let cfg = config.ec2; in
6868 diskNr=$((diskNr + 1))
6969 echo "mounting $device on $mp..."
7070 if mountFS "$device" "$mp" "" ext3; then
71− if [ -z "$diskForUnionfs" ]; then diskForUnionfs="$mp"; fi
71+ if [ -z "$diskForUnionfs" -a \
72+ $(lsblk -bno size $device) -gt $(lsblk -bno size /dev/xvda1)
73+ ]; then
74+ diskForUnionfs="$mp";
75+ fi
7276 fi
7377 else
7478 echo "skipping unknown device type $device"