|
1 |
| -# This module automatically grows the root partition on virtual machines. |
2 |
| -# This allows an instance to be created with a bigger root filesystem |
3 |
| -# than provided by the machine image. |
4 |
| - |
5 |
| -{ config, lib, pkgs, ... }: |
6 |
| - |
7 |
| -with lib; |
8 |
| - |
9 |
| -{ |
10 |
| - |
11 |
| - options = { |
12 |
| - |
13 |
| - virtualisation.growPartition = mkOption { |
14 |
| - type = types.bool; |
15 |
| - default = true; |
16 |
| - }; |
17 |
| - |
18 |
| - }; |
19 |
| - |
20 |
| - config = mkIf config.virtualisation.growPartition { |
21 |
| - |
22 |
| - boot.initrd.extraUtilsCommands = '' |
23 |
| - copy_bin_and_libs ${pkgs.gawk}/bin/gawk |
24 |
| - copy_bin_and_libs ${pkgs.gnused}/bin/sed |
25 |
| - copy_bin_and_libs ${pkgs.utillinux}/sbin/sfdisk |
26 |
| - copy_bin_and_libs ${pkgs.utillinux}/sbin/lsblk |
27 |
| -
|
28 |
| - substitute "${pkgs.cloud-utils}/bin/.growpart-wrapped" "$out/bin/growpart" \ |
29 |
| - --replace "${pkgs.bash}/bin/sh" "/bin/sh" \ |
30 |
| - --replace "awk" "gawk" \ |
31 |
| - --replace "sed" "gnused" |
32 |
| -
|
33 |
| - ln -s sed $out/bin/gnused |
34 |
| - ''; |
35 |
| - |
36 |
| - boot.initrd.postDeviceCommands = '' |
37 |
| - rootDevice="${config.fileSystems."/".device}" |
38 |
| - if [ -e "$rootDevice" ]; then |
39 |
| - rootDevice="$(readlink -f "$rootDevice")" |
40 |
| - parentDevice="$(lsblk -npo PKNAME "$rootDevice")" |
41 |
| - TMPDIR=/run sh $(type -P growpart) "$parentDevice" "''${rootDevice#$parentDevice}" |
42 |
| - udevadm settle |
43 |
| - fi |
44 |
| - ''; |
45 |
| - |
46 |
| - }; |
47 |
| - |
48 |
| -} |
| 1 | +# This profile is deprecated, use boot.growPartition directly. |
| 2 | +builtins.trace "the profile <nixos/modules/virtualisation/grow-partition.nix> is deprecated, use boot.growPartition instead" |
| 3 | +{ } |
0 commit comments