infra/derivations/dev/go.nix

34 lines
777 B
Nix
Raw Normal View History

2015-10-23 01:26:53 +02:00
{
2016-05-23 00:37:21 +02:00
pkgs ? import /home/steveej/src/github/NixOS/nixpkgs {},
2015-10-23 01:26:53 +02:00
name ? "generic",
version,
extraBuildInputs ? [] }:
let
2016-06-28 11:39:21 -07:00
go = builtins.getAttr "go_${version}" pkgs;
goBuildInputs = with pkgs; [
go
gotools
#gotools.bin
gocode
gocode.bin
#godef godef.bin
godep
#godep.bin
gox.bin
#ginkgo ginkgo.bin
#gomega
2015-10-23 01:26:53 +02:00
];
2016-06-28 11:39:21 -07:00
goShellHook = { go, name }: ''
goname=${go.version}_$name
2016-05-23 00:39:28 +02:00
setPS1 $goname
2016-06-28 11:39:21 -07:00
export GOROOT=${go}/share/go
2015-10-23 01:26:53 +02:00
export GOPATH="$HOME/.gopath_$goname"
export PATH="$HOME/.gopath_$goname/bin:$PATH"
unset name
'';
in pkgs.stdenv.mkDerivation {
inherit name;
2016-06-28 11:39:21 -07:00
buildInputs = extraBuildInputs ++ goBuildInputs;
shellHook = (goShellHook) { inherit name; inherit go; };
2015-10-23 01:26:53 +02:00
}