nixos/tmproot: Ignore /persist symlinks whose targets don't exist

This commit is contained in:
Jack O'Sullivan 2022-06-10 23:42:20 +01:00
parent 3085df1710
commit ffdff3d403
2 changed files with 6 additions and 0 deletions

View File

@ -37,6 +37,11 @@ let
if os.access(target, os.F_OK):
recurse(target, link=p)
return
if ${if enablePersistence then "True" else "False"} and target.startswith('${cfg.persistence.dir}'):
# A symlink whose target cannot be accessed but starts with /persist... almost certaily re-generated on
# activation
return
elif stat.S_ISDIR(st.st_mode):
for e in os.listdir(p):
recurse(os.path.join(p, e))

View File

@ -68,6 +68,7 @@ in
parentDirectory = perms;
}) [
"/home/${user'.name}/.bash_history"
"/home/${user'.name}/.lesshst"
];
directories = map (directory: {
inherit directory;