mirror of
https://github.com/nix-community/disko.git
synced 2024-09-11 06:25:33 +03:00
types btrfs: fix format without swap or subvolumes
This commit is contained in:
parent
9e0bf2fe7f
commit
79eab0e82c
37
example/btrfs-only-root-subvolume.nix
Normal file
37
example/btrfs-only-root-subvolume.nix
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
vdb = {
|
||||
type = "disk";
|
||||
device = "/dev/disk/by-diskseq/1";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
priority = 1;
|
||||
name = "ESP";
|
||||
start = "1M";
|
||||
end = "128M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
};
|
||||
};
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = [ "-f" ]; # Override existing partition
|
||||
mountpoint = "/";
|
||||
mountOptions = [ "compress=zstd" "noatime" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -120,6 +120,7 @@ in
|
||||
if ! (blkid '${config.device}' -o export | grep -q '^TYPE='); then
|
||||
mkfs.btrfs "${config.device}" ${toString config.extraArgs}
|
||||
fi
|
||||
${lib.optionalString (config.swap != {} || config.subvolumes != {}) ''
|
||||
if (blkid "${config.device}" -o export | grep -q '^TYPE=btrfs$'); then
|
||||
${lib.optionalString (config.swap != {}) ''
|
||||
(
|
||||
@ -143,6 +144,7 @@ in
|
||||
)
|
||||
'') (lib.attrValues config.subvolumes)}
|
||||
fi
|
||||
''}
|
||||
'';
|
||||
};
|
||||
_mount = diskoLib.mkMountOption {
|
||||
|
11
tests/btrfs-only-root-subvolume.nix
Normal file
11
tests/btrfs-only-root-subvolume.nix
Normal file
@ -0,0 +1,11 @@
|
||||
{ pkgs ? import <nixpkgs> { }
|
||||
, diskoLib ? pkgs.callPackage ../lib { }
|
||||
}:
|
||||
diskoLib.testLib.makeDiskoTest {
|
||||
inherit pkgs;
|
||||
name = "btrfs-only-root-subvolume";
|
||||
disko-config = ../example/btrfs-only-root-subvolume.nix;
|
||||
extraTestScript = ''
|
||||
machine.succeed("btrfs subvolume list /");
|
||||
'';
|
||||
}
|
Loading…
Reference in New Issue
Block a user