Closed chris-martin closed 8 years ago
As I mention in https://github.com/NixOS/nixpkgs/pull/14904#issuecomment-214195812 it's just a PoC and I working on major rework on common-libs
branch. So there's no docs here :/ and I plan to write about usage when I settle with implementation. But it should be usable right now generating derivations with complete dependency set.
First, you need to setup you Go environment with proper GOPATH
https://github.com/golang/go/wiki/GOPATH.
Then try to do:
$ go get -u github.com/btcsuite/btcd/...
$ cd $GOPATH/src/github.com/btcsuite/btcd
$ go2nix save
It should produce complete default.nix
that you can build or include somewhere in nixpkgs.
Simple cloning won't work, because go get
download all dependencies that needs to be present before generating nix derivation. This is how most Go projects manage its dependencies.
buildGoPackage
can use json files for dependencies like in https://github.com/NixOS/nixpkgs/blob/7d02cc1dd50766058b2ec2c6d3a741d96db5d27b/doc/languages-frameworks/go.xml and go2nix
master supports this new format.
README.md was updated too.
With the Haskell infrastructure, I check out a project and run
cabal2nix . > projectname.nix
.So for Go, I tried the same thing. I cloned btcd, and then
Okay, so it doesn't look in the present working directory by default?
Is that a bug? It says a directory is outside of itself.
(I'm gussing this would be clear if I were already more familiar with building Go projects, but I haven't used Go before.)