feat: add disks

This commit is contained in:
TheWanderingCrow 2025-05-27 22:13:59 -04:00
parent 579365f2a8
commit 4b38b8bd2c
2 changed files with 71 additions and 16 deletions

View file

@ -0,0 +1,71 @@
{
lib,
disk ? "/dev/vda",
withSwap ? false,
swapSize,
config,
...
}: {
disko.devices = {
disk = {
disk0 = {
type = "disk";
device = disk;
content = {
type = "gpt";
partitions = {
ESP = {
priority = 1;
name = "ESP";
start = "1M";
end = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = ["defaults"];
};
};
root = {
size = "100%";
content = {
type = "btrfs";
extraArgs = ["-f"]; # Override existing partition
# Subvolumes must set a mountpoint in order to be mounted,
# unless their parent is mounted
subvolumes = {
"@root" = {
mountpoint = "/";
mountOptions = [
"compress=zstd"
"noatime"
];
};
"@persist" = {
mountpoint = "${config.hostSpec.persistFolder}";
mountOptions = [
"compress=zstd"
"noatime"
];
};
"@nix" = {
mountpoint = "/nix";
mountOptions = [
"compress=zstd"
"noatime"
];
};
"@swap" = lib.mkIf withSwap {
mountpoint = "/.swapvol";
swap.swapfile.size = "${swapSize}G";
};
};
};
};
};
};
};
};
};
}

View file

@ -1,16 +0,0 @@
{
lib,
pkgs,
disk ? "/dev/vda",
withSwap ? false,
swapSize,
config,
...
}: {
disko.devices = {
disk = {
disk0 = {
};
};
};
}