forked from iburzynski/jambhala
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.justfile
128 lines (105 loc) · 3.04 KB
/
.justfile
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# direnv allow
@allow:
direnv allow
# direnv reload
@reload:
direnv reload
# codium editor
@code DIRECTORY='.':
if [ "{{ DIRECTORY }}" = "." ] || [ -d "{{ DIRECTORY }}" ]; then \
if [ "${VIM_MODE}" = 'true' ]; then \
codium {{ DIRECTORY }}; \
else codium {{ DIRECTORY }} --disable-extension asvetliakov.vscode-neovim; \
fi \
else echo "Invalid directory: {{ DIRECTORY }}"; \
fi
# jamb cli
@cli *OPTS:
cabal run . -- {{ OPTS }} 2>&1 || true
# cabal repl
@repl:
cabal repl
# print env vars
@vars:
python3 jsetup-utils/check_env.py jambhala
hls-bin := `which haskell-language-server`
# generate .env file from template
@mk-env:
mk-env.sh
# create HLS symlink
@link-hls:
if [ -n "{{ hls-bin }}" ]; then \
ln -s -f "{{ hls-bin }}" .vscode/haskell-language-server.link; \
else echo "haskell-language-server not found!"; \
fi
hoogle-port := "8080"
# start hoogle server
@hoogle:
echo "Starting Hoogle server @ http://localhost:{{ hoogle-port }}..."
hoogle server --local -p {{ hoogle-port }} >/dev/null
haskell-sources := "$(find src j-cli -type f -name '*.hs')"
cabal-sources := "$(find . -maxdepth 1 -type f -name '*.cabal')"
fourmolu-exts := "-o -XQuasiQuotes -o -XTemplateHaskell -o -XTypeApplications -o -XImportQualifiedPost"
# format flake.nix, *.cabal, and *.hs files
@fmt:
echo "Formatting..."
nixpkgs-fmt flake.nix > /dev/null 2>&1
cabal-fmt -i {{ cabal-sources }} > /dev/null 2>&1
fourmolu {{ fourmolu-exts }} -m inplace {{ haskell-sources }} > /dev/null 2>&1
echo "Formatting complete."
# run cardano-ez-installer
@install-cardano:
python3 cardano-ez-installer/main.py
node-network-id := env_var('CARDANO_NODE_NETWORK_ID')
node-network := if node-network-id == "1" { "preprod" } else if node-network-id == "2" { "preview" } else { "mainnet" }
cardano-path := env_var('CARDANO_PATH')
network-path := cardano-path / node-network
socket-path := cardano-path / "node.socket"
config-path := network-path / "config"
node-port := "1337"
# run cardano-node
@node:
cardano-node run \
--topology {{ config-path }}/topology.json \
--database-path {{ network-path }}/db \
--socket-path {{ socket-path }} \
--port {{ node-port }} \
--config {{ config-path }}/config.json
# launch jambhalucid
@lucid:
cd jambhalucid && if [ ! -d "node_modules" ]; then \
pnpm install; \
fi && pnpm dev
# clean nix store
@gc:
nix-collect-garbage -d
# update Jambhala
@update *OPTS:
jupdate.sh {{ OPTS }} jambhala
# personalize project
@personalize:
personalize.sh jambhala
# show plutus-apps commit history (q to exit)
@pa-history:
dir=`find dist-newstyle/src -type d -name 'plutus-ap_*' -print -quit`; \
if [ -n "$dir" ]; then \
cd "dist-newstyle/src/$(basename "$dir")"; \
git fetch; \
git log; 2>/dev/null || true; \
else \
echo "Error: plutus-apps directory not found"; \
fi
# rebuild project
@rebuild:
rm -rf .direnv
rm -rf .cabal
cabal clean
direnv allow
# reset .env files to defaults
@reset-env:
rm .env
rm cardano-cli-guru/.env
direnv allow
# run setup wizard
@setup:
setup.sh