From 169e99dc3db0a501d5f12ded0d03684e9361c985 Mon Sep 17 00:00:00 2001 From: Ctem Date: Sun, 10 Dec 2023 04:43:39 +0000 Subject: [PATCH] fix: create btrfs subvolume parent directories Fixes #409 --- lib/types/btrfs.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/types/btrfs.nix b/lib/types/btrfs.nix index a4e59ef..a9b2dc2 100644 --- a/lib/types/btrfs.nix +++ b/lib/types/btrfs.nix @@ -126,8 +126,10 @@ in MNTPOINT=$(mktemp -d) mount ${config.device} "$MNTPOINT" -o subvol=/ trap 'umount $MNTPOINT; rm -rf $MNTPOINT' EXIT - btrfs subvolume create "$MNTPOINT"/${subvol.name} ${toString subvol.extraArgs} - ${swapCreate "$MNTPOINT/${subvol.name}" subvol.swap} + SUBVOL_ABS_PATH="$MNTPOINT/${subvol.name}" + mkdir -p "$(dirname "$SUBVOL_ABS_PATH")" + btrfs subvolume create "$SUBVOL_ABS_PATH" ${toString subvol.extraArgs} + ${swapCreate "$SUBVOL_ABS_PATH" subvol.swap} ) '') (lib.attrValues config.subvolumes)} '';