29 lines
872 B
Nix
29 lines
872 B
Nix
{ pkgs, ... }:
|
|
pkgs.mkShell {
|
|
packages = with pkgs; [
|
|
go
|
|
gopls
|
|
go-tools
|
|
golangci-lint
|
|
golangci-lint-langserver
|
|
jdk17
|
|
];
|
|
|
|
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
|
|
if ! grep -q "^\.gradle$" "$TOP/.gitignore" "$TOP/.git/info/exclude"; then echo ".gradle" >> "$TOP/.git/info/exclude"; fi
|
|
else
|
|
TOP="$(pwd)"
|
|
fi
|
|
|
|
export GOPATH="$TOP/.go"
|
|
export GOPROXY=goproxy.unx.sas.com
|
|
export GONOSUMDB=*.sas.com,sassoftware.io
|
|
export JAVA_HOME="${pkgs.jdk17.home}"
|
|
export GRADLE_USER_HOME="$TOP/.gradle"
|
|
mkdir -p "$GRADLE_USER_HOME" && cp -f ~/.gradle/gradle.properties "$GRADLE_USER_HOME/gradle.properties"
|
|
'';
|
|
}
|