From 5c94f13b7c931daf2c921b4d6a7e4c293bfcb425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Wed, 6 Nov 2024 09:17:37 +0100 Subject: [PATCH] persist cache files for 7 days --- modules/environment/impermanence.nix | 4 ++++ modules/environment/user-impermanence.nix | 2 ++ 2 files changed, 6 insertions(+) diff --git a/modules/environment/impermanence.nix b/modules/environment/impermanence.nix index 6c03b0d3..de0ff570 100644 --- a/modules/environment/impermanence.nix +++ b/modules/environment/impermanence.nix @@ -98,6 +98,7 @@ with lib; { directories = [ "/var/log" "/var/lib/nixos" + "/var/cache" ]; files = [ "/etc/ssh/ssh_host_ecdsa_key" @@ -108,6 +109,9 @@ with lib; { "/etc/ssh/ssh_host_rsa_key.pub" ]; }; + systemd.tmpfiles.rules = [ + "d /persistent/var/cache 1777 root root 7d -" + ]; }) ]; } diff --git a/modules/environment/user-impermanence.nix b/modules/environment/user-impermanence.nix index 519afee9..d28b2f87 100644 --- a/modules/environment/user-impermanence.nix +++ b/modules/environment/user-impermanence.nix @@ -27,10 +27,12 @@ with lib; { "Pictures" "Documents" "Videos" + ".cache" ]; }; }) config.environment.impermanence.users); + systemd.tmpfiles.rules = map (name: "d /persistent/home/${name}/.cache 700 ${name} ${name} 7d -") config.environment.impermanence.users; systemd.services = listToAttrs (flatten (map (name: let cfg = config.users.users.${name}; in [