add btrfs subvolumes
This commit is contained in:
+14
@@ -69,6 +69,18 @@ let
|
||||
|
||||
create-f = q: x: create.${x.type} q x;
|
||||
|
||||
create.btrfs = q: x: ''
|
||||
mkfs.btrfs ${q.device}
|
||||
${lib.optionalString (!isNull x.subvolumes or null) ''
|
||||
MNTPOINT=$(mktemp -d)
|
||||
(
|
||||
mount ${q.device} "$MNTPOINT"
|
||||
trap 'umount $MNTPOINT; rm -rf $MNTPOINT' EXIT
|
||||
${concatMapStringsSep "\n" (subvolume: "btrfs subvolume create \"$MNTPOINT\"/${subvolume}") x.subvolumes}
|
||||
)
|
||||
''}
|
||||
'';
|
||||
|
||||
create.filesystem = q: x: ''
|
||||
mkfs.${x.format} ${q.device}
|
||||
'';
|
||||
@@ -178,6 +190,8 @@ let
|
||||
'';
|
||||
};
|
||||
|
||||
mount.btrfs = mount.filesystem;
|
||||
|
||||
mount.devices = q: x: let
|
||||
z = foldl' recursiveUpdate {} (mapAttrsToList (name: mount-f { device = "/dev/${name}"; inherit name; }) x.content);
|
||||
# attrValues returns values sorted by name. This is important, because it
|
||||
|
||||
Reference in New Issue
Block a user