recovery: grow fs to partition size before starting sshd

sshd expects there to be space in /persist/secrets that it can
use to write host keys, but when we make ext4fs images we don't
put any free space in them
pull/5/head
Daniel Barlow 2024-01-28 11:30:19 +00:00
parent 9e199c6957
commit 84ce618213
1 changed files with 14 additions and 1 deletions

View File

@ -44,13 +44,16 @@ in rec {
dependencies = [ config.services.hostname ];
};
services.sshd = svc.ssh.build { };
services.sshd = svc.ssh.build {
dependencies = [ config.services.growfs ];
};
services.defaultroute4 = svc.network.route.build {
via = "$(output ${services.dhcpc} router)";
target = "default";
dependencies = [services.dhcpc];
};
services.resolvconf = oneshot rec {
dependencies = [ services.dhcpc ];
name = "resolvconf";
@ -63,6 +66,16 @@ in rec {
)
'';
};
services.growfs = let name = "growfs"; in oneshot {
inherit name;
up = ''
. ${serviceFns}
device=$(grep /persist /proc/1/mountinfo | cut -f9 -d' ')
${pkgs.e2fsprogs}/bin/resize2fs $device
'';
};
filesystem = dir {
etc = dir {
"resolv.conf" = symlink "${services.resolvconf}/.outputs/resolv.conf";