go2nix icon indicating copy to clipboard operation
go2nix copied to clipboard

How to generate expressions for Hugo?

Open kskyten opened this issue 6 years ago • 2 comments

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?

kskyten avatar Jul 31 '17 18:07 kskyten

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

kamilchm avatar Aug 01 '17 11:08 kamilchm

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.

kskyten avatar Aug 02 '17 07:08 kskyten