dev/{go,rkt}: add extraShellHook with rkt functionality

This commit is contained in:
steveej 2016-08-31 15:59:53 +02:00
parent 2a7c73e748
commit dcf4cdd88b
2 changed files with 51 additions and 11 deletions

View file

@ -2,8 +2,10 @@
pkgs ? import /home/steveej/src/github/NixOS/nixpkgs {},
name ? "generic",
version,
extraBuildInputs ? [] }:
let
extraBuildInputs ? [],
extraShellHook ? ""
}:
let
go = builtins.getAttr "go_${version}" pkgs;
buildInputs = with pkgs; [
glibc.out
@ -21,16 +23,27 @@ let
#ginkgo ginkgo.bin
#gomega
];
goShellHook = { go, name }: ''
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
'';
in pkgs.stdenv.mkDerivation {
inherit name;
shellHook = (goShellHook) { inherit name; inherit go; };
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}
'';
}