tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
amazon-grow-partition module: autodetect the root device
Nathan Zadoks
9 years ago
1de8e1b0
986e6428
+6
-2
1 changed file
expand all
collapse all
unified
split
nixos
modules
virtualisation
amazon-grow-partition.nix
+6
-2
nixos/modules/virtualisation/amazon-grow-partition.nix
···
10
10
copy_bin_and_libs ${pkgs.gawk}/bin/gawk
11
11
copy_bin_and_libs ${pkgs.gnused}/bin/sed
12
12
copy_bin_and_libs ${pkgs.utillinux}/sbin/sfdisk
13
13
+
copy_bin_and_libs ${pkgs.utillinux}/sbin/lsblk
13
14
cp -v ${pkgs.cloud-utils}/bin/growpart $out/bin/growpart
14
15
ln -s sed $out/bin/gnused
15
16
'';
16
17
17
18
boot.initrd.postDeviceCommands = ''
18
18
-
if [ -e /dev/xvda ] && [ -e /dev/xvda1 ]; then
19
19
-
TMPDIR=/run sh $(type -P growpart) /dev/xvda 1
19
19
+
rootDevice="${config.fileSystems."/".device}"
20
20
+
if [ -e "$rootDevice" ]; then
21
21
+
rootDevice="$(readlink -f "$rootDevice")"
22
22
+
parentDevice="$(lsblk -npo PKNAME "$rootDevice")"
23
23
+
TMPDIR=/run sh $(type -P growpart) "$parentDevice" "''${rootDevice#$parentDevice}"
20
24
udevadm settle
21
25
fi
22
26
'';