diff --git a/lib/types/bcachefs.nix b/lib/types/bcachefs.nix index a1e00a15..bce84367 100644 --- a/lib/types/bcachefs.nix +++ b/lib/types/bcachefs.nix @@ -64,6 +64,8 @@ # The current file should not run the `bcachefs format` command. Instead, the`bcachefs format` command will be ran # in the `_create` attribute in bcachefs_filesystem.nix, once it has collected and generated the arguments specifying the devices that should be part of the filesystem. default = '' + # Write devices to temporary directory for bcachefs_filesystem. + printf '%s\n' '${config.device}' >> "$disko_devices_dir/bcachefs-${lib.escapeShellArg config.filesystem}-devices"; # Write device arguments to temporary directory for bcachefs_filesystem. { printf '%s\n' '--label=${config.label}'; diff --git a/lib/types/bcachefs_filesystem.nix b/lib/types/bcachefs_filesystem.nix index 8a453672..bbfefd41 100644 --- a/lib/types/bcachefs_filesystem.nix +++ b/lib/types/bcachefs_filesystem.nix @@ -7,6 +7,10 @@ rootMountPoint, ... }: +let + # colon separated list of devices, as UUID expansion is unreliable + colonSeparatedDevices = ''$(paste -sd ":" "$disko_devices_dir/bcachefs-${config.name}-devices")''; +in { options = { name = lib.mkOption { @@ -197,7 +201,7 @@ mount \ -t bcachefs \ -o "${lib.concatStringsSep "," (lib.unique ([ "X-mount.mkdir" ] ++ config.mountOptions))}" \ - "/dev/disk/by-uuid/${config.uuid}" \ + "${colonSeparatedDevices}" \ "$MNTPOINT"; trap 'umount "$MNTPOINT"; rm -rf "$MNTPOINT"; rm -rf "$TEMPDIR";' EXIT; SUBVOL_ABS_PATH="$MNTPOINT/${subvolume.name}"; @@ -244,7 +248,7 @@ ) ) }" \ - "/dev/disk/by-uuid/${config.uuid}" \ + "${colonSeparatedDevices}" \ "${rootMountPoint}${subvolume.mountpoint}"; fi; ''; @@ -266,7 +270,7 @@ mount \ -t bcachefs \ -o "${lib.concatStringsSep "," (lib.unique ([ "X-mount.mkdir" ] ++ config.mountOptions))}" \ - "/dev/disk/by-uuid/${config.uuid}" \ + "${colonSeparatedDevices}" \ "${rootMountPoint}${config.mountpoint}"; fi; '';