From 1dad7f68219c6097d9897fef26287796ad66c2f2 Mon Sep 17 00:00:00 2001 From: Jared Baur Date: Fri, 5 Jan 2024 01:04:30 -0800 Subject: [PATCH] nixos/repart: add loop module to initrd Systemd-repart will use loopback devices for partition creation if it is able to, and will fallback to doing "offline" partition creation writing data directly to files. From what I see looking at the repart code, there are specific features that cannot be taken advantage of when not using loopback devices (e.g. no BTRFS subvolumes in systemd v255) and in certain places they have to perform some manual re-sizing work that can otherwise be avoided. --- nixos/modules/system/boot/systemd/repart.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nixos/modules/system/boot/systemd/repart.nix b/nixos/modules/system/boot/systemd/repart.nix index 5ac2ace56ba0..3be744acd0b3 100644 --- a/nixos/modules/system/boot/systemd/repart.nix +++ b/nixos/modules/system/boot/systemd/repart.nix @@ -83,6 +83,9 @@ in } ]; + # systemd-repart uses loopback devices for partition creation + boot.initrd.availableKernelModules = lib.optional initrdCfg.enable "loop"; + boot.initrd.systemd = lib.mkIf initrdCfg.enable { additionalUpstreamUnits = [ "systemd-repart.service"