2016-11-17 00:09:52 +01:00
|
|
|
{ gitpkgs ? import /home/steveej/src/github/NixOS/nixpkgs {}
|
|
|
|
, pkgs ? gitpkgs
|
|
|
|
, name ? "generic"
|
|
|
|
, version
|
|
|
|
, extraBuildInputs ? []
|
|
|
|
, extraShellHook ? ""
|
2016-08-31 15:59:53 +02:00
|
|
|
}:
|
|
|
|
let
|
2016-06-28 11:39:21 -07:00
|
|
|
go = builtins.getAttr "go_${version}" pkgs;
|
2016-11-17 20:45:01 +01:00
|
|
|
commonVimRC = ''
|
|
|
|
let g:tagbar_type_go = {
|
|
|
|
\ 'ctagstype' : 'go',
|
|
|
|
\ 'kinds' : [
|
|
|
|
\ 'p:package',
|
|
|
|
\ 'i:imports:1',
|
|
|
|
\ 'c:constants',
|
|
|
|
\ 'v:variables',
|
|
|
|
\ 't:types',
|
|
|
|
\ 'n:interfaces',
|
|
|
|
\ 'w:fields',
|
|
|
|
\ 'e:embedded',
|
|
|
|
\ 'm:methods',
|
|
|
|
\ 'r:constructor',
|
|
|
|
\ 'f:functions'
|
|
|
|
\ ],
|
|
|
|
\ 'sro' : '.',
|
|
|
|
\ 'kind2scope' : {
|
|
|
|
\ 't' : 'ctype',
|
|
|
|
\ 'n' : 'ntype'
|
|
|
|
\ },
|
|
|
|
\ 'scope2kind' : {
|
|
|
|
\ 'ctype' : 't',
|
|
|
|
\ 'ntype' : 'n'
|
|
|
|
\ },
|
|
|
|
\ 'ctagsbin' : 'gotags',
|
|
|
|
\ 'ctagsargs' : '-sort -silent'
|
|
|
|
\ }
|
|
|
|
|
|
|
|
" vim-go {
|
|
|
|
let g:go_highlight_functions = 1
|
|
|
|
let g:go_highlight_methods = 1
|
|
|
|
let g:go_highlight_structs = 1
|
|
|
|
let g:go_highlight_interfaces = 1
|
|
|
|
let g:go_highlight_operators = 1
|
|
|
|
let g:go_highlight_build_constraints = 1
|
|
|
|
let g:go_fmt_command = 'gofmt'
|
|
|
|
let g:go_fmt_options= '-s'
|
|
|
|
let g:go_def_mode = 'godef'
|
|
|
|
let g:go_def_reuse_buffer = 0
|
|
|
|
|
|
|
|
au FileType go nmap <Leader>gds <Plug>(go-def-split)
|
|
|
|
au FileType go nmap <Leader>gdv <Plug>(go-def-vertical)
|
|
|
|
au FileType go nmap <Leader>gdt <Plug>(go-def-tab)
|
|
|
|
au FileType go nmap <Leader>gi <Plug>(go-imports)
|
|
|
|
" }
|
|
|
|
'';
|
2016-07-26 17:33:33 -07:00
|
|
|
buildInputs = with pkgs; [
|
|
|
|
glibc.out
|
|
|
|
glibc.static
|
|
|
|
|
2016-06-28 11:39:21 -07:00
|
|
|
go
|
|
|
|
gotools
|
|
|
|
#gotools.bin
|
2016-11-17 00:09:52 +01:00
|
|
|
#gocode.bin
|
2016-06-28 11:39:21 -07:00
|
|
|
#godef godef.bin
|
|
|
|
godep
|
|
|
|
#godep.bin
|
|
|
|
gox.bin
|
|
|
|
#ginkgo ginkgo.bin
|
|
|
|
#gomega
|
2016-11-17 20:45:01 +01:00
|
|
|
( import ./vim-go.nix { pkgs=gitpkgs; commonRC=commonVimRC; } )
|
2017-01-18 16:13:22 +01:00
|
|
|
# ( import ./neovim-go.nix { pkgs=gitpkgs; commonRC=commonVimRC; } )
|
2015-10-23 01:26:53 +02:00
|
|
|
];
|
2016-08-31 15:59:53 +02:00
|
|
|
|
2015-10-23 01:26:53 +02:00
|
|
|
in pkgs.stdenv.mkDerivation {
|
|
|
|
inherit name;
|
2016-07-26 17:33:33 -07:00
|
|
|
buildInputs = extraBuildInputs ++ buildInputs;
|
2016-08-31 15:59:53 +02:00
|
|
|
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
|
2016-11-17 00:09:52 +01:00
|
|
|
go get -u github.com/nsf/gocode
|
2016-08-31 15:59:53 +02:00
|
|
|
${extraShellHook}
|
|
|
|
'';
|
2015-10-23 01:26:53 +02:00
|
|
|
}
|