system: add tmpfs mountpoint "/home/tmp"

This commit is contained in:
Elec3137 2026-03-03 13:59:11 -08:00
commit e83b537953

View file

@ -60,10 +60,20 @@ in
# consider disabling if you have very limited memory
boot.tmp = lib.mkDefault {
useTmpfs = true;
tmpfsSize = "70%";
tmpfsHugeMemoryPages = "within_size";
};
fileSystems."/home/tmp" = lib.mkDefault {
fsType = "tmpfs";
# inherit options created by boot.tmp.useTmpfs if avaliable
options =
let
tmpMount = lib.findFirst (mount: mount.where == "/tmp") null config.systemd.mounts;
in
lib.mkIf (tmpMount != null) (lib.splitStringBy (p: c: c == ",") false tmpMount.mountConfig.Options);
};
# run fstrim monthly instead of weekly
# weekly is unecessary for preventing long-term performance degredation
# https://unix.stackexchange.com/questions/218076/ssd-how-often-should-i-do-fstrim