mirror of
https://github.com/TECHNOFAB11/disko.git
synced 2025-12-11 23:50:05 +01:00
add btrfs subvolumes
This commit is contained in:
parent
dadc491330
commit
81e704b638
3 changed files with 80 additions and 0 deletions
14
default.nix
14
default.nix
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue