flakes/hosts/hyacinth/filesystem.nix

51 lines
1.6 KiB
Nix
Raw Permalink Normal View History

2023-06-18 20:54:08 +07:00
{ config, lib, ... }:
2023-01-28 00:12:28 +07:00
let
mkLabelMount = label: type: {
device = "/dev/disk/by-label/${label}";
fsType = type;
options = [ "defaults" "relatime" ];
};
2023-06-18 20:54:08 +07:00
mkBtrfsMount = name: subvol: atime: mkLabelMount name "btrfs" // {
2023-01-28 00:12:28 +07:00
options = [ "autodefrag" "compress=zstd:3" "defaults" "discard=async" "space_cache=v2" "ssd" "subvol=${subvol}" (if atime then "relatime" else "noatime") ];
};
2023-06-18 20:54:08 +07:00
mkCakeMount = mkBtrfsMount "CAKE";
2023-01-28 00:12:28 +07:00
in
{
fileSystems = {
"/" = {
device = "rootfs";
fsType = "tmpfs";
options = [ "defaults" "size=24G" "mode=755" ];
2023-01-28 00:12:28 +07:00
};
"/boot" = mkLabelMount "CUP" "vfat";
2023-06-18 20:54:08 +07:00
"/mnt/butter" = mkCakeMount "/" true;
"/mnt/cream" = mkBtrfsMount "CREAM" "/" true;
"/mnt/cream/permanence/.snapshots" = mkBtrfsMount "CREAM" "/snapshot/permanence" false;
"/nix" = mkCakeMount "/current/snow" false;
"/home" = mkCakeMount "/current/home" true;
"/home/.snapshots" = mkCakeMount "/snapshot/home" false;
"/root" = mkCakeMount "/current/root" false;
"/var" = mkCakeMount "/current/var" false;
2023-01-28 00:12:28 +07:00
"/persist" = {
depends = [ "/var" ];
device = "/var/persist";
fsType = "none";
options = [ "bind" ];
neededForBoot = true;
};
};
2023-06-18 20:54:08 +07:00
services.snapper.configs.cream = {
2023-06-18 21:19:05 +07:00
FSTYPE = "btrfs";
SUBVOLUME = "/mnt/cream/permanence";
2023-06-18 21:31:39 +07:00
TIMELINE_CLEANUP = true;
TIMELINE_CREATE = true;
2023-06-18 21:19:05 +07:00
TIMELINE_MIN_AGE = "1800";
TIMELINE_LIMIT_HOURLY = "5";
TIMELINE_LIMIT_DAILY = "7";
TIMELINE_LIMIT_WEEKLY = "0";
TIMELINE_LIMIT_MONTHLY = "0";
TIMELINE_LIMIT_YEARLY = "0";
2023-06-18 20:54:08 +07:00
};
2023-01-28 00:12:28 +07:00
}