2024-03-16 17:18:20 +01:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
2024-01-09 23:48:38 +01:00
|
|
|
let
|
2024-03-16 17:18:20 +01:00
|
|
|
fsOptions = [
|
|
|
|
"noatime"
|
|
|
|
"ssd"
|
|
|
|
"space_cache"
|
|
|
|
"compress=zstd"
|
|
|
|
];
|
2024-01-09 23:48:38 +01:00
|
|
|
in
|
|
|
|
{
|
|
|
|
# encrypted partitions
|
|
|
|
boot.initrd.luks = {
|
|
|
|
devices =
|
|
|
|
# allow discards on all devices
|
2024-03-16 17:18:20 +01:00
|
|
|
builtins.mapAttrs (name: val: val // { allowDiscards = true; }) {
|
2024-01-09 23:48:38 +01:00
|
|
|
"system".device = "/dev/disk/by-uuid/85154131-b2a8-4ef5-9d74-47429cb267ef";
|
|
|
|
"cryptswap".device = "/dev/disk/by-uuid/ac586df6-6332-4809-beb1-f51906a2adaa";
|
|
|
|
"ssd2".device = "/dev/disk/by-uuid/cadd4e1f-3642-4faa-8d4e-37dd85465df1";
|
|
|
|
};
|
2024-03-16 17:18:20 +01:00
|
|
|
reusePassphrases = true;
|
2024-01-09 23:48:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
fileSystems = {
|
|
|
|
"/" = {
|
|
|
|
device = "/dev/disk/by-uuid/cb5998ae-cfc9-447f-8756-1ceaec6ca4c4";
|
|
|
|
fsType = "btrfs";
|
|
|
|
options = fsOptions ++ [ "subvol=nixos_root" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
"/boot" = {
|
|
|
|
device = "/dev/disk/by-uuid/DED9-661B";
|
|
|
|
fsType = "vfat";
|
|
|
|
options = [ "discard" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
"/home" = {
|
|
|
|
device = "/dev/disk/by-uuid/cb5998ae-cfc9-447f-8756-1ceaec6ca4c4";
|
|
|
|
fsType = "btrfs";
|
|
|
|
options = fsOptions ++ [ "subvol=home" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
"/var/tmp" = {
|
|
|
|
device = "/dev/disk/by-uuid/cd6b8f25-c029-49a6-b326-656faec3ce15";
|
|
|
|
fsType = "btrfs";
|
|
|
|
options = fsOptions ++ [ "subvol=vartmp" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
"/var/log" = {
|
|
|
|
device = "/dev/disk/by-uuid/cd6b8f25-c029-49a6-b326-656faec3ce15";
|
|
|
|
fsType = "btrfs";
|
|
|
|
options = fsOptions ++ [ "subvol=varlog" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
"/var/cache" = {
|
|
|
|
device = "/dev/disk/by-uuid/cd6b8f25-c029-49a6-b326-656faec3ce15";
|
|
|
|
fsType = "btrfs";
|
|
|
|
options = fsOptions ++ [ "subvol=varcache" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.fstrim.enable = true;
|
|
|
|
services.btrfs.autoScrub = {
|
|
|
|
enable = true;
|
2024-03-16 17:18:20 +01:00
|
|
|
fileSystems = [
|
|
|
|
"/"
|
|
|
|
"/home"
|
|
|
|
];
|
2024-01-09 23:48:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
boot.tmp.useTmpfs = true;
|
|
|
|
fileSystems."/tmp".fsType = "tmpfs";
|
|
|
|
|
2024-03-16 17:18:20 +01:00
|
|
|
services.smartd = {
|
|
|
|
enable = true;
|
|
|
|
devices = [
|
|
|
|
{ device = "/dev/sda"; }
|
|
|
|
{ device = "/dev/sdb"; }
|
|
|
|
];
|
|
|
|
};
|
2024-01-09 23:48:38 +01:00
|
|
|
}
|