nixos/tmproot: Ignore /persist symlinks whose targets don't exist
This commit is contained in:
		@@ -37,6 +37,11 @@ let
 | 
				
			|||||||
            if os.access(target, os.F_OK):
 | 
					            if os.access(target, os.F_OK):
 | 
				
			||||||
              recurse(target, link=p)
 | 
					              recurse(target, link=p)
 | 
				
			||||||
              return
 | 
					              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):
 | 
					          elif stat.S_ISDIR(st.st_mode):
 | 
				
			||||||
            for e in os.listdir(p):
 | 
					            for e in os.listdir(p):
 | 
				
			||||||
              recurse(os.path.join(p, e))
 | 
					              recurse(os.path.join(p, e))
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -68,6 +68,7 @@ in
 | 
				
			|||||||
              parentDirectory = perms;
 | 
					              parentDirectory = perms;
 | 
				
			||||||
            }) [
 | 
					            }) [
 | 
				
			||||||
              "/home/${user'.name}/.bash_history"
 | 
					              "/home/${user'.name}/.bash_history"
 | 
				
			||||||
 | 
					              "/home/${user'.name}/.lesshst"
 | 
				
			||||||
            ];
 | 
					            ];
 | 
				
			||||||
            directories = map (directory: {
 | 
					            directories = map (directory: {
 | 
				
			||||||
              inherit directory;
 | 
					              inherit directory;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user