-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathshell.nix
More file actions
60 lines (55 loc) · 1.8 KB
/
shell.nix
File metadata and controls
60 lines (55 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{
stdenv,
pkgs,
lib,
}:
(pkgs.pkgs.mkShell {
buildInputs = with pkgs;
[
# Development
go-task
golangci-lint
# Required for Sui CLI (Move compilation)
git
# Go 1.26.2+ + tools
go_1_26
gopls
mockgen
# bun for typescript examples
bun
# Keep adding as needed
# Sui CLI custom derivation
(pkgs.callPackage ./sui.nix {})
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
libiconv
];
shellHook = ''
>&2 echo "Setting up clean Go environment (disabling GVM)..."
# Unset GVM environment leakage
unset GOROOT
unset GOPATH
unset GOTOOLDIR
# Require Go 1.26.2; allow toolchain auto-selection to upgrade if needed
export GOTOOLCHAIN=go1.26.2
# Add Nix-provided Go binary path to ensure consistency
export PATH=$(go env GOROOT)/bin:$PATH
# Debug info
>&2 echo "Using Go at: $(which go)"
>&2 go version
required_go="1.26.2"
current_go=$(go version | awk '{print $3}' | sed 's/go//')
if [ "$(printf '%s\n' "$required_go" "$current_go" | sort -V | head -n1)" != "$required_go" ]; then
>&2 echo "Go $current_go found, but >= $required_go is required. Update Nix or go_1_26."
return 1
fi
>&2 bun --version
# use upstream golangci-lint config from core Chainlink repository, overriding the local prefixes
alias golint="golangci-lint run --config <(curl -sSL https://raw.githubusercontent.com/smartcontractkit/chainlink/develop/.golangci.yml | yq e '.formatters.settings.goimports.local-prefixes = [\"github.com/smartcontractkit/chainlink-ton\"]' -) --path-mode \"abs\""
>&2 echo ""
>&2 echo "You can lint your code with:"
>&2 echo " cd relayer && golint ./..."
>&2 echo " cd integration-tests && golint ./..."
>&2 echo ""
'';
})