From 2c40806b9370ffbbfcf15487cd714173c7ac8811 Mon Sep 17 00:00:00 2001 From: Bert Proesmans Date: Sun, 2 Nov 2025 13:43:02 +0000 Subject: [PATCH] feat(mdadm); start mdadm before mounting datasets --- lib/types/mdadm.nix | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/types/mdadm.nix b/lib/types/mdadm.nix index 277d9bc..bf28200 100644 --- a/lib/types/mdadm.nix +++ b/lib/types/mdadm.nix @@ -82,8 +82,19 @@ }; _mount = diskoLib.mkMountOption { inherit config options; - default = lib.optionalAttrs (config.content != null) config.content._mount; - # TODO we probably need to assemble the mdadm somehow + default = + let + content = lib.optionalAttrs (config.content != null) config.content._mount; + in + { + fs = content.fs or { }; + dev = '' + if ! test -e "/dev/md/${config.name}"; then + mdadm --assemble --scan + fi + ${content.dev or ""} + ''; + }; }; _unmount = diskoLib.mkUnmountOption { inherit config options;