Hello,
I’m a Go newbie which is trying to build the Flux package, whose
source code can be found at GitHub - fluxcd/flux: Successor: https://github.com/fluxcd/flux2
. There’s a brief document with instructions here:
https://github.com/weaveworks/flux/blob/4fa5fd4e487cc6b8670b44d47cd99e92924edb3f/site/building.md
Following this and the scarce documentation in the nixpkgs manual
I ended up with using dep2nix
to convert the dependencies to the Nix equivalent deps.nix
and I’ve created the
following recipe (default.nix
):
with import <nixpkgs> {};
buildGo110Package rec {
name = "fluxctl";
version = "1.11.1";
goPackagePath = "github.com/weaveworks/flux";
src = ./.;
goDeps = ./deps.nix;
meta = with stdenv.lib; {
description = "The GitOps Kubernetes operator";
license = licenses.apache;
homepage = https://github.com/weaveworks/flux;
};
}
but this is in part a failure (see https://termbin.com/t8ey for the
full log) which
shows lines where the compiler complains writing:
# github.com/weaveworks/flux/registry
go/src/github.com/weaveworks/flux/registry/client.go:115:42: cannot use &manifestDigest (type *"github.com/opencontainers/go-digest".Digest) as type *"github.com/docker/distribution/vendor/github.com/opencontainers/go-digest".Digest in argument to "github.com/docker/distribution/registry/client".ReturnContentDigest
go/src/github.com/weaveworks/flux/registry/client.go:116:56: cannot use "github.com/opencontainers/go-digest".Digest(ref) (type "github.com/opencontainers/go-digest".Digest) as type "github.com/docker/distribution/vendor/github.com/opencontainers/go-digest".Digest in argument to manifests.Get
but incredibly the compilation continues (so i thought it was just a
warning), but ends with an obscure error 28 which i failed to look up:
[...]
k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset
builder for '/nix/store/axzjwjs2wyk3yvm9537hz42mlak2q00g-fluxctl.drv' failed with exit code 28
error: build of '/nix/store/axzjwjs2wyk3yvm9537hz42mlak2q00g-fluxctl.drv' failed
No one (nor in the #nixos channel or on the Flux’s slack channel) had
a clue, but investigating that “vendor” thing mentioned in the logs
wondered if that dep ensure
mentioned on the building document
is somewhat missing, so I ended up with one last try:
with import <nixpkgs> {};
buildGo110Package rec {
name = "fluxctl";
version = "1.11.1";
buildInputs = [ go_1_10 dep ];
goPackagePath = "github.com/weaveworks/flux";
src = ./.;
goDeps = ./deps.nix;
postConfigure = ''
cd go/src/$goPackagePath
dep ensure
'';
meta = with stdenv.lib; {
description = "The GitOps Kubernetes operator";
license = licenses.apache;
homepage = https://github.com/weaveworks/flux;
};
}
but it ends with an error too ( for the full log see
https://termbin.com/i4n0 )
[...]
The following issues were found in Gopkg.toml:
✗ unable to deduce repository and source type for "k8s.io/api": unable to read metadata: unable to fetch raw metadata: failed HTTP request to URL "http://k8s.io/api?go-get=1": Get http://k8s.io/api?go-get=1: dial tcp: lookup k8s.io on [::1]:53: read udp [::1]:40298->[::1]:53: read: connection refused
✗ unable to deduce repository and source type for "k8s.io/client-go": unable to read metadata: unable to fetch raw metadata: failed HTTP request to URL "http://k8s.io/client-go?go-get=1": Get http://k8s.io/client-go?go-get=1: dial tcp: lookup k8s.io on [::1]:53: read udp [::1]:40298->[::1]:53: read: connection refused
✗ unable to deduce repository and source type for "k8s.io/code-generator": unable to read metadata: unable to fetch raw metadata: failed HTTP request to URL "http://k8s.io/code-generator?go-get=1": Get http://k8s.io/code-generator?go-get=1: dial tcp: lookup k8s.io on [::1]:53: read udp [::1]:40298->[::1]:53: read: connection refused
✗ unable to deduce repository and source type for "k8s.io/apiextensions-apiserver": unable to read metadata: unable to fetch raw metadata: failed HTTP request to URL "http://k8s.io/apiextensions-apiserver?go-get=1": Get http://k8s.io/apiextensions-apiserver?go-get=1: dial tcp: lookup k8s.io on [::1]:53: read udp [::1]:40298->[::1]:53: read: connection refused
✗ unable to deduce repository and source type for "k8s.io/apimachinery": unable to read metadata: unable to fetch raw metadata: failed HTTP request to URL "http://k8s.io/apimachinery?go-get=1": Get http://k8s.io/apimachinery?go-get=1: dial tcp: lookup k8s.io on [::1]:53: read udp [::1]:40298->[::1]:53: read: connection refused
✗ unable to deduce repository and source type for "k8s.io/helm": unable to read metadata: unable to fetch raw metadata: failed HTTP request to URL "http://k8s.io/helm?go-get=1": Get http://k8s.io/helm?go-get=1: dial tcp: lookup k8s.io on [::1]:53: read udp [::1]:40298->[::1]:53: read: connection refused
ProjectRoot name validation failed
builder for '/nix/store/rlfvaw0nspzmzds0gzirzyqwqsrvg0j2-fluxctl.drv' failed with exit code 1
Now, I’m all at sea, If anyone knows what to do he/she is very welcome
Also, I’ve yet to figure out how to compile just the
$(GOPATH)/bin/fluxctl
(as it’s mentioned in the Makefile) which is
what’s really interesting to me.