summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--nix/libstore/gc.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/nix/libstore/gc.cc b/nix/libstore/gc.cc
index f90edac1cd..e7285fb7dd 100644
--- a/nix/libstore/gc.cc
+++ b/nix/libstore/gc.cc
@@ -328,6 +328,12 @@ static void findRoots(StoreAPI & store, const Path & path, Roots & roots)
             }
         }
 
+        else if (S_ISREG(st.st_mode)) {
+            Path storePath = settings.nixStore + "/" + baseNameOf(path);
+            if (store.isValidPath(storePath))
+                roots[path] = storePath;
+        }
+
     }
 
     catch (SysError & e) {