1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-27 20:51:00 +01:00

* `nix-store -qb' to query derivation environment bindings. Useful

for finding build-time dependencies (possibly after a build).  E.g.,

    $ nix-store -qb aterm $(nix-store -qd $(which strc))
    /nix/store/jw7c7s65n1gwhxpn35j9rgcci6ilzxym-aterm-2.3.1

* Arguments to nix-store can be files within store objects, e.g.,
  /nix/store/jw7c...-aterm-2.3.1/bin/baffle.

* Idem for garbage collector roots.
This commit is contained in:
Eelco Dolstra 2005-02-07 14:32:44 +00:00
parent 450c358e20
commit fbc434ee4c
4 changed files with 60 additions and 16 deletions

View file

@ -176,12 +176,18 @@ void copyPath(const Path & src, const Path & dst)
}
bool isStorePath(const Path & path)
bool isInStore(const Path & path)
{
return path[0] == '/'
&& path.compare(0, nixStore.size(), nixStore) == 0
&& path.size() >= nixStore.size() + 2
&& path[nixStore.size()] == '/'
&& path[nixStore.size()] == '/';
}
bool isStorePath(const Path & path)
{
return isInStore(path)
&& path.find('/', nixStore.size() + 1) == Path::npos;
}
@ -193,6 +199,18 @@ void assertStorePath(const Path & path)
}
Path toStorePath(const Path & path)
{
if (!isInStore(path))
throw Error(format("path `%1%' is not in the Nix store") % path);
unsigned int slash = path.find('/', nixStore.size() + 1);
if (slash == Path::npos)
return path;
else
return Path(path, 0, slash);
}
void canonicalisePathMetaData(const Path & path)
{
checkInterrupt();