Skip to content

Commit 4f4aa65

Browse files
feat(mdadm); start mdadm before mounting datasets
1 parent 7e9b6b8 commit 4f4aa65

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

lib/types/mdadm.nix

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,19 @@
7575
};
7676
_mount = diskoLib.mkMountOption {
7777
inherit config options;
78-
default = lib.optionalAttrs (config.content != null) config.content._mount;
79-
# TODO we probably need to assemble the mdadm somehow
78+
default =
79+
let
80+
content = lib.optionalAttrs (config.content != null) config.content._mount;
81+
in
82+
{
83+
fs = content.fs or { };
84+
dev = ''
85+
if ! test -e "/dev/md/${config.name}"; then
86+
mdadm --assemble --scan
87+
fi
88+
${content.dev or ""}
89+
'';
90+
};
8091
};
8192
_unmount = diskoLib.mkUnmountOption {
8293
inherit config options;

0 commit comments

Comments
 (0)