nix/systems/nixos-desk/disko.nix

193 lines
5.8 KiB
Nix
Raw Permalink Normal View History

2025-02-24 17:26:11 +01:00
let
cryptOpenArgs = [
"--allow-discards"
"--perf-same_cpu_crypt"
"--perf-submit_from_crypt_cpus"
"--perf-no_read_workqueue"
"--perf-no_write_workqueue"
];
in
{
disko.devices = {
disk = {
cryptboot_1 = {
type = "disk";
device = "/dev/disk/by-id/nvme-CT1000P1SSD8_2003E28202D0";
content = {
type = "gpt";
partitions = {
luks = {
# size = "831.5G";
end = "-100G";
# label = "Linux LUKS";
type = "8309";
content = {
type = "luks";
name = "cryptboot_1";
extraOpenArgs = cryptOpenArgs;
passwordFile = "/tmp/secret.key";
additionalKeyFiles = [ ];
# content is empty here as the btrfs partition will be created via extraArgs of the cryptroot_1 partition def
};
};
luksSwap = {
size = "32G";
content = {
type = "luks";
name = "cryptswap_1";
extraOpenArgs = cryptOpenArgs;
passwordFile = "/tmp/secret.key";
additionalKeyFiles = [ ];
content = {
type = "swap";
};
};
};
};
};
};
cryptboot_0 = {
type = "disk";
device = "/dev/disk/by-id/nvme-Samsung_SSD_970_EVO_Plus_1TB_S4EWNX0NB42209Z";
content = {
type = "gpt";
partitions = {
luks = {
# size = "831.5G";
end = "-100G";
# label = "Linux LUKS";
type = "8309";
content = {
type = "luks";
name = "cryptboot_0";
extraOpenArgs = cryptOpenArgs;
passwordFile = "/tmp/secret.key";
additionalKeyFiles = [ ];
content = {
# this partiton needs to be in the last parent part alphabetically to ensure the referenced dev already exists
type = "btrfs";
extraArgs = [
"-L cryptboot_btrfs"
"-f"
"-m raid1"
"-d raid1"
"/dev/mapper/cryptboot_0"
];
subvolumes = {
"/" = {
mountpoint = "/media/@btrfsroot";
mountOptions = [
"rw"
"autodefrag"
"compress=zstd"
"discard=async"
"relatime"
"space_cache=v2"
"ssd"
];
};
"/_active" = { };
"/_active/rootvol" = { };
"/_active/pkgvol" = { };
"/_active/nix_rootvol" = {
mountpoint = "/";
mountOptions = [
"rw"
"autodefrag"
"compress=zstd"
"discard=async"
"relatime"
"space_cache=v2"
"ssd"
];
};
"/_active/homevol" = {
mountpoint = "/home";
mountOptions = [
"rw"
"autodefrag"
"compress=zstd"
"discard=async"
"relatime"
"space_cache=v2"
"ssd"
];
};
"/_active/nixvol" = {
mountpoint = "/nix";
mountOptions = [
"rw"
"autodefrag"
"compress=zstd"
"discard=async"
"relatime"
"space_cache=v2"
"ssd"
];
};
};
};
};
};
ESP = {
label = "EFI_0";
name = "ESP";
size = "1024M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
"rw"
"relatime"
"fmask=0022"
"dmask=0022"
"codepage=437"
"iocharset=ascii"
"shortname=mixed"
"utf8"
"errors=remount-ro"
];
};
};
};
};
};
sandisk = {
type = "disk";
device = "/dev/disk/by-id/ata-SanDisk_SDSSDH3_4T00_211011800267";
content = {
type = "gpt";
partitions = {
luks = {
# ~size = "3.4T";
end = "-250G";
label = "SanDisk";
type = "8300";
content = {
type = "btrfs";
extraArgs = [ ];
subvolumes = {
"/" = {
mountpoint = "/media/SanDisk";
mountOptions = [
"rw"
"autodefrag"
"compress=zstd"
"discard=async"
"relatime"
"space_cache=v2"
"ssd"
];
};
};
};
};
};
};
};
};
};
}