Add go devshell

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2025-01-06 13:44:43 +02:00
parent 249c089718
commit 31f3364f06
14 changed files with 111 additions and 34 deletions

View File

@@ -0,0 +1,22 @@
{ pkgs, ... }:
pkgs.mkShell {
packages = with pkgs; [
go
gopls
go-tools
];
shellHook = ''
export P10K_EXTRA_RIGHT_PROMPT_ELEMENTS=(
goenv
"''${P10K_EXTRA_RIGHT_PROMPT_ELEMENTS[@]}"
)
if git rev-parse --is-inside-work-tree &> /dev/null && ! grep -q "^\.go$" .gitignore .git/info/exclude; then
echo ".go" >> .git/info/exclude
export GOPATH="$(git rev-parse --show-toplevel)/.go"
else
export GOPATH="$(pwd)/.go"
fi
'';
}