fix(btrfs): subvolume mount behaviour

Since subvolumes appear automatically when their parent is mounted, no
action is required until the user wants them to be mounted somewhere
else.
This allows access to the volume manager capabilities of BTRFS.
This commit is contained in:
rogarb committed 2023-07-21 16:15:51 +02:00
1 parent f2248036d2
commit 7f3b98f72b
1 file changed
+4 -10
+4 -10
View File
@@ -91,16 +91,10 @@
let let
subvolMounts = lib.concatMapAttrs subvolMounts = lib.concatMapAttrs
(_: subvol: (_: subvol:
let lib.optionalAttrs (subvol.mountpoint != null) {
mountpoint = ${subvol.mountpoint} = ''
if (subvol.mountpoint != null) then subvol.mountpoint if ! findmnt ${config.device} "${rootMountPoint}${subvol.mountpoint}" > /dev/null 2>&1; then
else if (config.mountpoint == null) then subvol.name mount ${config.device} "${rootMountPoint}${subvol.mountpoint}" \
else null;
in
lib.optionalAttrs (mountpoint != null) {
${mountpoint} = ''
if ! findmnt ${config.device} "${rootMountPoint}${mountpoint}" > /dev/null 2>&1; then
mount ${config.device} "${rootMountPoint}${mountpoint}" \
${lib.concatMapStringsSep " " (opt: "-o ${opt}") (subvol.mountOptions ++ [ "subvol=${subvol.name}" ])} \ ${lib.concatMapStringsSep " " (opt: "-o ${opt}") (subvol.mountOptions ++ [ "subvol=${subvol.name}" ])} \
-o X-mount.mkdir -o X-mount.mkdir
fi fi