diff options
author | Nathan Zadoks <nathan@nathan7.eu> | 2016-02-17 12:59:51 +0100 |
---|---|---|
committer | Nathan Zadoks <nathan@nathan7.eu> | 2016-08-30 16:48:04 -0400 |
commit | 1de8e1b02ef9bd5e65382f0b3998106ffc328094 (patch) | |
tree | 8fec437909972f51ea64054f84f1ef42fa2b7d5b /nixos/modules/virtualisation | |
parent | 986e64280e40edb7b03e40216204e2f7fbe4e396 (diff) | |
download | nixlib-1de8e1b02ef9bd5e65382f0b3998106ffc328094.tar nixlib-1de8e1b02ef9bd5e65382f0b3998106ffc328094.tar.gz nixlib-1de8e1b02ef9bd5e65382f0b3998106ffc328094.tar.bz2 nixlib-1de8e1b02ef9bd5e65382f0b3998106ffc328094.tar.lz nixlib-1de8e1b02ef9bd5e65382f0b3998106ffc328094.tar.xz nixlib-1de8e1b02ef9bd5e65382f0b3998106ffc328094.tar.zst nixlib-1de8e1b02ef9bd5e65382f0b3998106ffc328094.zip |
amazon-grow-partition module: autodetect the root device
Diffstat (limited to 'nixos/modules/virtualisation')
-rw-r--r-- | nixos/modules/virtualisation/amazon-grow-partition.nix | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/nixos/modules/virtualisation/amazon-grow-partition.nix b/nixos/modules/virtualisation/amazon-grow-partition.nix index 69b80d900bad..02a0dd65fdc0 100644 --- a/nixos/modules/virtualisation/amazon-grow-partition.nix +++ b/nixos/modules/virtualisation/amazon-grow-partition.nix @@ -10,13 +10,17 @@ copy_bin_and_libs ${pkgs.gawk}/bin/gawk copy_bin_and_libs ${pkgs.gnused}/bin/sed copy_bin_and_libs ${pkgs.utillinux}/sbin/sfdisk + copy_bin_and_libs ${pkgs.utillinux}/sbin/lsblk cp -v ${pkgs.cloud-utils}/bin/growpart $out/bin/growpart ln -s sed $out/bin/gnused ''; boot.initrd.postDeviceCommands = '' - if [ -e /dev/xvda ] && [ -e /dev/xvda1 ]; then - TMPDIR=/run sh $(type -P growpart) /dev/xvda 1 + rootDevice="${config.fileSystems."/".device}" + if [ -e "$rootDevice" ]; then + rootDevice="$(readlink -f "$rootDevice")" + parentDevice="$(lsblk -npo PKNAME "$rootDevice")" + TMPDIR=/run sh $(type -P growpart) "$parentDevice" "''${rootDevice#$parentDevice}" udevadm settle fi ''; |