hyacinth/filesystem: add cream

This commit is contained in:
LavaDesu 2023-06-18 20:54:08 +07:00
parent 71ef24eab2
commit 7c499fed49
Signed by: cilly
GPG key ID: 6500251E087653C9

View file

@ -1,13 +1,14 @@
{ config, ... }:
{ config, lib, ... }:
let
mkLabelMount = label: type: {
device = "/dev/disk/by-label/${label}";
fsType = type;
options = [ "defaults" "relatime" ];
};
mkBtrfsMount = subvol: atime: mkLabelMount "CAKE" "btrfs" // {
mkBtrfsMount = name: subvol: atime: mkLabelMount name "btrfs" // {
options = [ "autodefrag" "compress=zstd:3" "defaults" "discard=async" "space_cache=v2" "ssd" "subvol=${subvol}" (if atime then "relatime" else "noatime") ];
};
mkCakeMount = mkBtrfsMount "CAKE";
in
{
fileSystems = {
@ -18,12 +19,14 @@ in
};
"/boot" = mkLabelMount "CUP" "vfat";
"/mnt/butter" = mkBtrfsMount "/" true;
"/nix" = mkBtrfsMount "/current/snow" false;
"/home" = mkBtrfsMount "/current/home" true;
"/home/.snapshots" = mkBtrfsMount "/snapshot/home" false;
"/root" = mkBtrfsMount "/current/root" false;
"/var" = mkBtrfsMount "/current/var" false;
"/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;
"/persist" = {
depends = [ "/var" ];
device = "/var/persist";
@ -32,4 +35,18 @@ in
neededForBoot = true;
};
};
services.snapper.configs.cream = {
fstype = "btrfs";
subvolume = "/mnt/cream/permanence";
extraConfig = lib.concatStringsSep "\n" (lib.mapAttrsToList (k: v: "${k}=${v}") {
TIMELINE_CLEANUP = "yes";
TIMELINE_CREATE = "yes";
TIMELINE_MIN_AGE = "1800";
TIMELINE_LIMIT_HOURLY = "5";
TIMELINE_LIMIT_DAILY = "7";
TIMELINE_LIMIT_WEEKLY = "0";
TIMELINE_LIMIT_MONTHLY = "0";
TIMELINE_LIMIT_YEARLY = "0";
});
};
}