From ffdff3d40309f9477ee28abdbd463871b4fcb8c9 Mon Sep 17 00:00:00 2001 From: Jack O'Sullivan Date: Fri, 10 Jun 2022 23:42:20 +0100 Subject: [PATCH] nixos/tmproot: Ignore /persist symlinks whose targets don't exist --- nixos/modules/tmproot.nix | 5 +++++ nixos/modules/user.nix | 1 + 2 files changed, 6 insertions(+) diff --git a/nixos/modules/tmproot.nix b/nixos/modules/tmproot.nix index bfadae5..af68fc6 100644 --- a/nixos/modules/tmproot.nix +++ b/nixos/modules/tmproot.nix @@ -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)) diff --git a/nixos/modules/user.nix b/nixos/modules/user.nix index 353b152..e5cd9b3 100644 --- a/nixos/modules/user.nix +++ b/nixos/modules/user.nix @@ -68,6 +68,7 @@ in parentDirectory = perms; }) [ "/home/${user'.name}/.bash_history" + "/home/${user'.name}/.lesshst" ]; directories = map (directory: { inherit directory;