79 lines
1.9 KiB
Nix
79 lines
1.9 KiB
Nix
{ config, lib, ... }:
|
|
|
|
let
|
|
cfg = config.format;
|
|
in
|
|
{
|
|
options.format = {
|
|
device = lib.mkOption {
|
|
type = lib.types.str;
|
|
description = "The device to format";
|
|
};
|
|
};
|
|
|
|
config = {
|
|
disko.devices = {
|
|
disk.main = {
|
|
type = "disk";
|
|
device = cfg.device;
|
|
content = {
|
|
type = "gpt";
|
|
partitions = {
|
|
boot = {
|
|
name = "boot";
|
|
size = "1M";
|
|
type = "EF02";
|
|
};
|
|
esp = {
|
|
name = "esp";
|
|
size = "512M";
|
|
type = "EF00";
|
|
content = {
|
|
type = "filesystem";
|
|
format = "vfat";
|
|
mountpoint = "/boot";
|
|
};
|
|
};
|
|
swap = {
|
|
name = "swap";
|
|
size = "32G";
|
|
content = {
|
|
type = "swap";
|
|
resumeDevice = true;
|
|
};
|
|
};
|
|
root = {
|
|
name = "root";
|
|
size = "100%";
|
|
content = {
|
|
name = "luks";
|
|
type = "luks";
|
|
settings = {
|
|
allowDiscards = true;
|
|
};
|
|
content = {
|
|
type = "btrfs";
|
|
extraArgs = ["-f"];
|
|
subvolumes = {
|
|
"/root" = {
|
|
mountpoint = "/";
|
|
};
|
|
"/persist" = {
|
|
mountpoint = "/persist";
|
|
mountOptions = ["subvol=persist" "compress=zstd" "noatime"];
|
|
};
|
|
"/nix" = {
|
|
mountpoint = "/nix";
|
|
mountOptions = ["subvol=nix" "compress=zstd" "noatime"];
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|