2019-03-01 18:01:33 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2019-05-22 16:04:45 +00:00
|
|
|
#
|
|
|
|
# Run this file to regenerate the Nix files in ./output.
|
|
|
|
# Prerequisites: Node, npm, and node2nix (installed with npm i -g https://github.com/svanderburg/node2nix)
|
|
|
|
#
|
|
|
|
|
2019-06-04 17:00:19 +00:00
|
|
|
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
2019-03-01 18:01:33 +00:00
|
|
|
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
|
|
|
|
toolversion="${GIT_ROOT}/scripts/toolversion"
|
|
|
|
dir="$SCRIPTPATH"
|
|
|
|
input="${dir}/output/node-packages.json"
|
|
|
|
output_dir="${dir}/output"
|
2019-06-04 17:00:19 +00:00
|
|
|
supplement_input="${dir}/output/supplement.json"
|
2019-03-01 18:01:33 +00:00
|
|
|
|
|
|
|
rm -rf $output_dir && mkdir -p $output_dir
|
2019-05-22 16:04:45 +00:00
|
|
|
# Specify the package.json file containing the dependencies to install
|
2019-03-01 18:01:33 +00:00
|
|
|
cat << EOF > $input
|
|
|
|
[
|
2019-06-04 16:50:29 +00:00
|
|
|
{ "realm": "https://github.com/status-im/realm-js/archive/v2.20.1.tar.gz" }
|
|
|
|
]
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# Specify the package.json file containing the build dependencies to install
|
|
|
|
cat << EOF > $supplement_input
|
|
|
|
[
|
|
|
|
"node-pre-gyp"
|
2019-03-01 18:01:33 +00:00
|
|
|
]
|
|
|
|
EOF
|
|
|
|
|
2019-06-04 17:00:19 +00:00
|
|
|
# Specify the package.json file containing the build dependencies to install
|
|
|
|
cat << EOF > $supplement_input
|
|
|
|
[
|
|
|
|
"node-pre-gyp"
|
|
|
|
]
|
|
|
|
EOF
|
|
|
|
|
2019-03-01 18:01:33 +00:00
|
|
|
node_required_version=$($toolversion node)
|
|
|
|
node_major_version=$(echo $node_required_version | cut -d. -f1,1)
|
2019-04-01 20:07:39 +00:00
|
|
|
|
2019-05-22 16:04:45 +00:00
|
|
|
node2nix --nodejs-${node_major_version} --bypass-cache \
|
2019-06-04 17:00:19 +00:00
|
|
|
--input $input \
|
|
|
|
--output $output_dir/node-packages.nix \
|
|
|
|
--supplement-input $supplement_input \
|
|
|
|
--supplement-output $output_dir/supplement.nix \
|
|
|
|
--composition $output_dir/default.nix \
|
|
|
|
--node-env $output_dir/node-env.nix
|
|
|
|
rm $input $supplement_input
|