cache Go vendor code in Nix pkgs.buildGoModule{}
Small nix file to keep the Go build cache around for Go projects which use Nix and vendor their modules.
Status: seems to work.
Usage: copy gocache.nix into your own project, and use it as an input:
...
cache = pkgs.callPackage ./gocache.nix { };
yourgomodule = pkgs.buildGoModule {
name = "yourgomodule";
buildInputs = [ cache ];
...
}
...
Based on https://github.com/numtide/build-go-cache .