nix/systems/nixos-fw16/disks.nix
2025-05-02 02:10:21 +02:00

71 lines
1.7 KiB
Nix

{ config
, lib
, pkgs
, modulesPath
, system
, inputs
, ...
}: {
# bcachefs format \
# --metadata_replicas=2 \
# --data_replicas=1 \
# --background_compression=zstd \
# --discard \
# --label=ssd.ssd_4t /dev/mapper/crypt_ssd_4t_data \
# --label=ssd.ssd_2t /dev/mapper/crypt_ssd_2t_data
config = {
boot = {
supportedFilesystems = [ "btrfs" "vfat" ];
initrd.supportedFilesystems = [ "btrfs" "vfat" ];
initrd.luks.devices =
lib.attrsets.mergeAttrsList
(
lib.lists.forEach [
"crypt_ssd_4t_data"
"crypt_ssd_4t_swap"
"crypt_ssd_2t_data"
"crypt_ssd_2t_swap"
]
(drive: {
"${drive}" = {
device = "/dev/disk/by-partlabel/${drive}";
allowDiscards = true;
bypassWorkqueues = true;
# crypttabExtraOpts = [ "nofail" ];
};
})
);
};
fileSystems = {
"/" = {
device = "/dev/mapper/crypt_ssd_4t_data";
# device = "UUID=f89215ba-3313-42d3-8f68-051ad2453870";
fsType = "btrfs";
options = [
"rw"
"autodefrag"
"compress=zstd"
"discard=async"
"relatime"
"space_cache=v2"
"ssd"
];
};
"/boot" = {
device = "/dev/disk/by-uuid/05A2-6A8A";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
};
swapDevices = [
{ device = "/dev/disk/by-uuid/0bbef1d5-d9d8-451c-8a37-b1d2847d5938"; }
{ device = "/dev/disk/by-uuid/23dcbbd6-cd95-4b86-b31e-27b1199043a7"; }
];
system.fsPackages = [ pkgs.sshfs ];
};
}