infra/derivations/dev/go.nix

49 lines
1.1 KiB
Nix

{
pkgs ? import /home/steveej/src/github/NixOS/nixpkgs {},
name ? "generic",
version,
extraBuildInputs ? [],
extraShellHook ? ""
}:
let
go = builtins.getAttr "go_${version}" pkgs;
buildInputs = with pkgs; [
glibc.out
glibc.static
go
gotools
#gotools.bin
gocode
gocode.bin
#godef godef.bin
godep
#godep.bin
gox.bin
#ginkgo ginkgo.bin
#gomega
];
in pkgs.stdenv.mkDerivation {
inherit name;
buildInputs = extraBuildInputs ++ buildInputs;
shellHook = ''
goname=${go.version}_$name
setPS1 $goname
export GOROOT=${go}/share/go
export GOPATH="$HOME/.gopath_$goname"
export PATH="$HOME/.gopath_$goname/bin:$PATH"
unset name
unset SSL_CERT_FILE
go get -u github.com/Masterminds/glide
go get -u github.com/sgotti/glide-vc
go get -u github.com/alecthomas/gometalinter
go get -u github.com/golang/lint/golint
go get -u github.com/rogpeppe/godef
go get -u github.com/kisielk/errcheck
go get -u github.com/jstemmer/gotags
go get -u github.com/klauspost/asmfmt/cmd/asmfmt
${extraShellHook}
'';
}