Skip to content

Commit 4e56034

Browse files
committed
nixos-modules/host: add update warning to activationScripts
1 parent c451ad0 commit 4e56034

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

nixos-modules/host/default.nix

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,5 +279,32 @@ in
279279

280280
# Enable Kernel Same-Page Merging
281281
hardware.ksm.enable = lib.mkDefault true;
282+
283+
# TODO: remove in 2026
284+
system.activationScripts.microvm-update-check = ''
285+
if [ -d ${stateDir} ]; then
286+
_outdated_microvms=""
287+
288+
for dir in ${stateDir}/*; do
289+
if [ -e $dir/current/share/microvm/virtiofs ] &&
290+
[ ! -e $dir/bin/virtiofsd-run ]; then
291+
_outdated_microvms="$_outdated_microvms $(basename $dir)"
292+
elif [ -e $dir/current/share/microvm/tap-interfaces ] &&
293+
[ ! -e $dir/bin/tap-up ]; then
294+
_outdated_microvms="$_outdated_microvms $(basename $dir)"
295+
elif [ -e $dir/current/share/microvm/macvtap-interfaces ] &&
296+
[ ! -e $dir/bin/macvtap-up ]; then
297+
_outdated_microvms="$_outdated_microvms $(basename $dir)"
298+
elif [ -e $dir/current/share/microvm/pci-devices ] &&
299+
[ ! -e $dir/bin/pci-setup ]; then
300+
_outdated_microvms="$_outdated_microvms $(basename $dir)"
301+
fi
302+
done
303+
304+
if [ "$_outdated_microvms" != "" ]; then
305+
echo "The following MicroVMs must be updated to follow the new virtiofsd/tap/macvtap/pci setup scheme: $_outdated_microvms"
306+
fi
307+
fi
308+
'';
282309
};
283310
}

0 commit comments

Comments
 (0)