[Nix-dev] nix-hash/NAR specification?

Eelco Dolstra eelco.dolstra at logicblox.com
Mon Oct 26 19:29:24 CET 2015


Hi,

On 26/10/15 18:57, Kamil Chmielewski wrote:

> I want to write simple tool to convert golang environments into Nix derivations.
> Something that I can use same way as godep but producing Nix derivation, similar
> to those created with go2nix.
> I implemented small PoC that reads all packages from $GOPATH/src to discover
> theirs repos and current revisions.
> One final thing I need is package hash. I don't want to use nix-prefetch because
> I  already have all sources there. I can't run nix-hash on sources with .git
> directories in it.
> I thought I can write nix-hash in Go to keep my code self-contained and concise.
> I found https://gist.github.com/jbeda/5c79d2b1434f0018d693 and saw Eelco PhD
> thesis but I don't know if it's still valid?

Yeah, that's still valid. If in doubt, check src/libutil/archive.cc.

> Is nix-hash just a checksum of path archived with NAR?

Yes, "nix-hash --type sha256 <PATH>" is the same as "nix-store --dump <PATH> |
nix-hash --type sha256 --flat /dev/stdin".

-- 
Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/


More information about the nix-dev mailing list