mirror of
https://github.com/NixOS/nix
synced 2025-06-26 20:01:15 +02:00
* nix-build: use an indirection scheme to make it easier for users to
get rid of GC roots. Nix-build places a symlink `result' in the current directory. Previously, removing that symlink would not remove the store path being linked to as a GC root. Now, the GC root created by nix-build is actually a symlink in `/nix/var/nix/gcroots/auto' to `result'. So if that symlink is removed the GC root automatically becomes invalid (since it can no longer be resolved). The root itself is not automatically removed - the garbage collector should delete dangling roots.
This commit is contained in:
parent
dcc37c236c
commit
630ae0c9d7
7 changed files with 101 additions and 50 deletions
|
@ -135,6 +135,15 @@ Path readLink(const Path & path)
|
|||
}
|
||||
|
||||
|
||||
bool isLink(const Path & path)
|
||||
{
|
||||
struct stat st;
|
||||
if (lstat(path.c_str(), &st))
|
||||
throw SysError(format("getting status of `%1%'") % path);
|
||||
return S_ISLNK(st.st_mode);
|
||||
}
|
||||
|
||||
|
||||
Strings readDirectory(const Path & path)
|
||||
{
|
||||
Strings names;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue