kamilchm / go2nix

Reproducible builds and development environment for Go
MIT License
93 stars 17 forks source link

How to generate expressions for Hugo? #61

Open kskyten opened 6 years ago

kskyten commented 6 years ago

I tried to generate the nix expression for Hugo without success. I ran

nix-env -p go git go2nix
mkdir hugobuild
cd hugobuild
export GOPATH=`pwd`
go get -v github.com/gohugoio/hugo
cd src/github.com/gohugoio/hugo
go2nix save

However, I dont't think that all of the dependencies are listed in deps.nix. It seems like the dependencies might be stored in vendor/vendor.json, but I'm not familiar with go at all. How do I generate the nix expressions for Hugo?

kamilchm commented 6 years ago

It looks like hugo is using govendor https://github.com/gohugoio/hugo/blob/master/Makefile#L15 Try to govendor sync its dependencies and move it somehow under GOPATH/src before go2nix save

There will be easier way when govendor will be supported by https://github.com/golang/dep/pull/815

kskyten commented 6 years ago

I noticed that the unstable channel had an updated version of hugo. I wasn't able to generate the nix expressions, although I didn't try very hard. If I come across another similar go package I need to package, I will try again.

As an aside, it would be great if you could document how to package go apps to users unfamiliar with go. The example with writing your own code is a bit confusing. If I understood correctly, you can generate nix expressions for packages by running go get and go2nix save in the downloaded src directory.