dotfiles/curacao/disko.nix

152 lines
4.6 KiB
Nix
Raw Permalink Normal View History

2024-02-17 18:39:09 +01:00
{ pkgs, lib, config, ... }:
# TODO Find a way to use keys in filesystem
# TODO Not relatime everywhere, thank you
# TODO Default options
let
2024-05-12 20:34:22 +02:00
btrfs_args_ssd = [
"rw"
"relatime"
"compress=zstd:3"
"space_cache"
2024-05-12 20:34:22 +02:00
"ssd"
];
passwordFile = "/tmp/dotfiles_${config.frogeye.name}_password";
in
{
disko.devices = {
disk = {
razmo = {
type = "disk";
2024-05-12 20:34:22 +02:00
device = "/dev/disk/by-id/ata-SDLF1DAR-960G-1HA1_A027C1A3";
content = {
type = "gpt";
partitions = {
2024-05-12 20:34:22 +02:00
ESP = {
# Needs enough to store multiple kernel generations
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
2024-05-12 20:34:22 +02:00
"defaults"
];
};
};
2024-05-12 20:34:22 +02:00
swap = {
size = "8G";
content = {
2024-05-12 20:34:22 +02:00
type = "swap";
randomEncryption = true;
# TODO NixOS documentation says not to use this with
# hibernation, as it can't set the partition where the
# hibernation image is saved. That's what I'm doing with Arch,
# but I'm setting resume=, should test if it actually works?
# Untranslated options from /etc/crypttab: swap,cipher=aes-xts-plain64,size=256
};
};
2024-05-12 20:34:22 +02:00
luks = {
size = "100%";
content = {
type = "luks";
name = "razmo";
2024-01-06 19:10:47 +01:00
passwordFile = passwordFile;
settings = {
2024-05-12 20:34:22 +02:00
allowDiscards = true;
};
content = {
type = "btrfs";
2024-05-12 20:34:22 +02:00
extraArgs = [ "-f" ];
mountpoint = "/mnt/razmo";
subvolumes = {
"home.razmo" = {
mountpoint = "/home.heavy";
2024-05-12 20:34:22 +02:00
mountOptions = [ "compress=zstd" "relatime" ];
};
"steam" = {
mountpoint = "/opt/steam.razmo";
mountOptions = [ "compress=zstd" "noatime" ];
};
};
};
};
};
};
};
};
rapido = {
type = "disk";
device = "/dev/disk/by-id/nvme-GIGABYTE_GP-GSM2NE3256GNTD_SN204508906665";
content = {
type = "gpt";
partitions = {
2023-12-12 20:59:31 +01:00
swap = {
priority = 10;
start = "2048";
size = "8G";
type = "8200"; # Linux swap
content = {
type = "luks";
name = "rapswap";
2024-01-06 19:10:47 +01:00
passwordFile = passwordFile;
settings = {
# keyFile = "/etc/keys/rapswap";
allowDiscards = true;
};
content = {
type = "swap";
resumeDevice = true;
# Untranslated options from /etc/fstab: defaults,pri=100
};
};
};
2023-12-12 20:59:31 +01:00
main = {
priority = 20;
content = {
type = "luks";
name = "rapido";
initrdUnlock = true;
2024-01-06 19:10:47 +01:00
passwordFile = passwordFile;
settings = {
# keyFile = "/etc/keys/rapido";
allowDiscards = true;
};
content = {
type = "btrfs";
# extraArgs = [ "-f" ];
mountpoint = "/mnt/rapido";
mountOptions = btrfs_args_ssd;
subvolumes = {
# Should be temporary, to make sure we can revert to Arch anytime
"home.nixos" = {
mountpoint = "/home";
mountOptions = btrfs_args_ssd;
};
"home.rapido" = {
mountpoint = "/mnt/old/home";
mountOptions = btrfs_args_ssd;
};
nix = {
mountpoint = "/nix";
mountOptions = btrfs_args_ssd;
};
nixos = {
mountpoint = "/";
};
};
};
};
};
};
};
};
};
};
2024-03-26 18:28:21 +01:00
services.btrfs.autoScrub = {
enable = true;
fileSystems = [ "/mnt/razmo" "/mnt/rapido" ];
# TODO Should be generable from disko config, right?
};
}