mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-11-13 12:13:46 +01:00
fix(aquamarine): persist the user's cache directory (#466)
On a tmpfs root the flake/fetch cache is empty at every boot, so `nix run <flake-ref>` re-downloads its input and fails until DNS is up: a reboot test showed llama-swap's first start failing on that. Other caches write into RAM meanwhile. Assisted-by: DeepSeek Harness (deepseek-flash)
This commit is contained in:
1 parent
e42d7adc88
commit
3d38ff7433
3 files changed
+18
-4
No files matched your search
@@ -73,17 +73,25 @@ in
|
||||
# re-downloading tens of GB is not a boot step.
|
||||
"models"
|
||||
|
||||
# Caches. A cold flake cache makes `nix run <flake-ref>` re-download its
|
||||
# input at boot, which needs DNS, and on a tmpfs root cache writes are RAM.
|
||||
".cache"
|
||||
|
||||
".config/systemd/user"
|
||||
".config/containers/systemd"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# `.config`/`.local` are not immediate parents of any persisted path here, so
|
||||
# tmpfiles would create them root:root 0755 and the user could not write
|
||||
# under them. Same fix as hosts/idols-ai/preservation.nix, plus the `.config`
|
||||
# subdirectories that hold a mount point.
|
||||
# The parents of the persisted paths below are not themselves persisted, so
|
||||
# tmpfiles would create them root:root 0755 and the user could not write under
|
||||
# them. Same fix as hosts/idols-ai/preservation.nix.
|
||||
systemd.tmpfiles.settings.preservation = {
|
||||
"/home/${username}/.cache".d = {
|
||||
user = username;
|
||||
group = lib.mkForce username;
|
||||
mode = lib.mkForce "0750";
|
||||
};
|
||||
"/home/${username}/.config".d = {
|
||||
user = username;
|
||||
group = lib.mkForce username;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
cStatesCapped = true;
|
||||
nativeIpv6Preference = true;
|
||||
sourceCheckoutsPersistent = true;
|
||||
cachePersistent = true;
|
||||
userUnitDirsPersistent = true;
|
||||
rootlessPodmanEnabled = true;
|
||||
stableKernel = true;
|
||||
|
||||
@@ -37,6 +37,11 @@ in
|
||||
d: d.directory == "/home/${myvars.username}/src"
|
||||
) cfg.preservation.preserveAt."/persistent".users.${myvars.username}.directories;
|
||||
|
||||
# A cold flake cache re-downloads the input of a `nix run <flake-ref>` at boot.
|
||||
cachePersistent = builtins.any (
|
||||
d: d.directory == "/home/${myvars.username}/.cache"
|
||||
) cfg.preservation.preserveAt."/persistent".users.${myvars.username}.directories;
|
||||
|
||||
# Directories the tmpfs root would otherwise drop.
|
||||
userUnitDirsPersistent =
|
||||
let
|
||||
|
||||
Reference in new issue
Block a user