-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.sh
executable file
·122 lines (85 loc) · 3 KB
/
init.sh
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
#!/usr/bin/env bash
#
# Initialisation script for setting up an integrated
# development environment for ValueFlows projects.
#
# If you are only contributing to one of the projects listed
# in .gitmodules, there is no need to use this repo. The setup
# here is to automate workflows where multiple core components
# are being developed in tandem, and changes need to be easily
# synchronised locally between each codebase.
#
HAS_NIX=$(command -v nix-shell >/dev/null 2>&1)
HAS_NIX=$?
bold=$(tput bold)
normal=$(tput sgr0)
function status_line() {
echo ""
echo "${bold}$1${normal}"
echo ""
}
if [[ ! $HAS_NIX ]]; then
status_line "Nix is not installed- see https://nixos.org/nix/download.html"
exit 1
fi
status_line "Configuring NPM to handle Nix env mismatches properly..."
npm config set scripts-prepend-node-path true
status_line "Registering modules..."
# Create submodules if not already present
git submodule init
git submodule update
status_line "Setup wiki docs..."
# All packages need to be put on master branch, as metadata in this repo is probably outdated.
pushd ecosystem-wiki
git checkout master
popd
# Configure HoloREA first, all commands will be run within its Nix environment
#
status_line "Setup Holo-REA..."
pushd holo-rea
git checkout sprout
# :SHONK: ensure PNPM is installed in the nix env
# :TODO: extend Holonix config correctly
nix-shell --run 'NPM=$(which npm); sudo $NPM i -g pnpm'
# setup dependencies
nix-shell --run 'pnpm i'
# build node modules but leave backend unbuilt until end (some devs may be mocking)
nix-shell --run 'npm run build:graphql-adapter'
popd
# build & register locally developed NPM modules
status_line "Setup vf-graphql..."
pushd vf-graphql
git checkout sprout
nix-shell --run 'pnpm i' ../holo-rea/default.nix
nix-shell --run 'npm run build' ../holo-rea/default.nix
popd
status_line "Setup vf-ui..."
pushd vf-ui
git checkout sprout
nix-shell --run 'pnpm i' ../holo-rea/default.nix
popd
status_line "Setup apps..."
pushd app-offers-needs-marketplace/
git checkout sprout
nix-shell --run 'pnpm i' ../holo-rea/default.nix
popd
pushd app-personal-agent/
git checkout sprout
nix-shell --run 'pnpm i' ../holo-rea/default.nix
popd
# cross-link local modules
status_line "Link cross-repo dependencies..."
pushd holo-rea/modules/vf-graphql-holochain/build
nix-shell --run 'pnpm link ../../../../vf-graphql/lib' ../../../default.nix
popd
pushd app-offers-needs-marketplace/src/graphql-client
nix-shell --run 'pnpm link ../../../holo-rea/modules/vf-graphql-holochain/build' ../../../holo-rea/default.nix
popd
pushd app-personal-agent/
nix-shell --run 'pnpm link ../app-offers-needs-marketplace/src/graphql-client' ../holo-rea/default.nix
nix-shell --run 'pnpm link ../app-offers-needs-marketplace/node_modules/.pnpm/[email protected]/node_modules/graphql' ../holo-rea/default.nix
popd
status_line "Finished installing. Continuing to build Holo-REA; if you don't need this please CTRL-C..."
pushd holo-rea
nix-shell --run 'npm run build'
popd