[Nix-dev] changing libstore to store packages as name-hash instead of hash-name
Erick Tryzelaar
idadesub at users.sourceforge.net
Wed Aug 6 04:37:01 CEST 2008
so i wanted to propose a change to libstore. a long time ago when I
first found nix, I found that since nix stores directories as
hash-name, it's very difficult to see what's actually installed since
things are sorted by the hash first, not the package name. So I
finally looked at the code and it looks like it'd be a pretty simple
to change this. It looks like we could do this by changing this
function in src/libstore/store-api.cc:
Path makeStorePath(const string & type,
const Hash & hash, const string & suffix)
{
/* e.g., "source:sha256:1abc...:/nix/store:foo.tar.gz" */
string s = type + ":sha256:" + printHash(hash) + ":"
+ nixStore + ":" + suffix;
checkStoreName(suffix);
return nixStore + "/"
+ printHash32(compressHash(hashString(htSHA256, s), 20))
+ "-" + suffix;
}
To this:
Path makeStorePath(const string & type,
const Hash & hash, const string & prefix)
{
/* e.g., "source:sha256:1abc...:/nix/store:foo.tar.gz" */
string s = type + ":sha256:" + printHash(hash) + ":"
+ nixStore + ":" + suffix;
checkStoreName(suffix);
return nixStore + "/"
+ prefix + "-"
+ printHash32(compressHash(hashString(htSHA256, s), 20))
}
So would others be interested in this this change (and everything else
that would need fixing that this would break)? It'd obviously wouldn't
be backwards compatible, but it could make things a little bit more
explorable.
More information about the nix-dev
mailing list