infra/derivations/dev/go.nix

36 lines
1,006 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
goPackages = builtins.getAttr "go${version}Packages" pkgs;
goBuildInputs = { goPackages }: [
goPackages.go
goPackages.tools
goPackages.tools.bin
goPackages.gocode
goPackages.gocode.bin
goPackages.godef
goPackages.godef.bin
goPackages.godep
goPackages.godep.bin
goPackages.gox.bin
2016-03-27 21:44:52 +02:00
goPackages.ginkgo
goPackages.ginkgo.bin
goPackages.gomega
2015-10-23 01:26:53 +02:00
];
goShellHook = { goPackages, name }: ''
goname=${goPackages.go.version}_$name
2016-05-23 00:39:28 +02:00
setPS1 $goname
2015-10-23 01:26:53 +02:00
export GOROOT=${goPackages.go}/share/go
export GOPATH="$HOME/.gopath_$goname"
export PATH="$HOME/.gopath_$goname/bin:$PATH"
unset name
'';
in pkgs.stdenv.mkDerivation {
inherit name;
buildInputs = extraBuildInputs ++ (goBuildInputs){ inherit goPackages; };
shellHook = (goShellHook) { inherit name; inherit goPackages; };
}