20 lines
409 B
Nix
20 lines
409 B
Nix
{ pkgs, ... }:
|
|
pkgs.mkShell {
|
|
packages = with pkgs; [
|
|
go
|
|
gopls
|
|
go-tools
|
|
];
|
|
|
|
shellHook = ''
|
|
if git rev-parse --is-inside-work-tree &> /dev/null; then
|
|
TOP="$(git rev-parse --show-toplevel)"
|
|
if ! grep -q "^\.go$" "$TOP/.gitignore" "$TOP/.git/info/exclude"; then echo ".go" >> "$TOP/.git/info/exclude"; fi
|
|
else
|
|
TOP="$(pwd)"
|
|
fi
|
|
|
|
export GOPATH="$TOP/.go"
|
|
'';
|
|
}
|