forked from clan/clan-core
format rootfs in vm itself
This commit is contained in:
parent
07caab537f
commit
11ac50c17b
@ -35,21 +35,24 @@ let
|
||||
boot.initrd.kernelModules = [ "virtiofs" ];
|
||||
virtualisation.writableStore = false;
|
||||
virtualisation.fileSystems = lib.mkForce ({
|
||||
"/" = {
|
||||
device = "/dev/disk/by-label/nixos";
|
||||
fsType = "ext4";
|
||||
options = [ "defaults" "x-systemd.makefs" ];
|
||||
};
|
||||
"/nix/store" = {
|
||||
device = "nix-store";
|
||||
options = [ "x-systemd.requires=systemd-modules-load.service" ];
|
||||
fsType = "virtiofs";
|
||||
};
|
||||
|
||||
"/" = {
|
||||
device = "/dev/vda";
|
||||
fsType = "ext4";
|
||||
noCheck = true;
|
||||
options = [ "defaults" "x-systemd.makefs" ];
|
||||
};
|
||||
|
||||
"/vmstate" = {
|
||||
device = "/dev/vdb";
|
||||
options = ["x-systemd.makefs"];
|
||||
options = [ "x-systemd.makefs" ];
|
||||
noCheck = true;
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
${config.clanCore.secretsUploadDirectory} = {
|
||||
|
@ -194,7 +194,6 @@ def prepare_disk(
|
||||
directory: Path,
|
||||
disk_format: str = "raw",
|
||||
size: str = "1024M",
|
||||
label: str = "nixos",
|
||||
file_name: str = "disk.img",
|
||||
) -> Path:
|
||||
disk_img = directory / file_name
|
||||
@ -215,21 +214,6 @@ def prepare_disk(
|
||||
error_msg=f"Could not create disk image at {disk_img}",
|
||||
)
|
||||
|
||||
if disk_format == "raw":
|
||||
cmd = nix_shell(
|
||||
["nixpkgs#e2fsprogs"],
|
||||
[
|
||||
"mkfs.ext4",
|
||||
"-L",
|
||||
label,
|
||||
str(disk_img),
|
||||
],
|
||||
)
|
||||
run(
|
||||
cmd,
|
||||
log=Log.BOTH,
|
||||
error_msg=f"Could not create ext4 filesystem at {disk_img}",
|
||||
)
|
||||
return disk_img
|
||||
|
||||
|
||||
@ -357,7 +341,6 @@ def run_vm(vm: VmConfig, nix_options: list[str] = []) -> None:
|
||||
file_name="state.qcow2",
|
||||
disk_format="qcow2",
|
||||
size="50G",
|
||||
label="state",
|
||||
)
|
||||
virtiofsd_socket = Path(sockets) / "virtiofsd.sock"
|
||||
qemu_cmd = qemu_command(
|
||||
|
Loading…
Reference in New Issue
Block a user