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-03-01 18:01:33 +00:00
|
|
|
GIT_ROOT=$(git rev-parse --show-toplevel)
|
|
|
|
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
|
|
|
|
toolversion="${GIT_ROOT}/scripts/toolversion"
|
|
|
|
dir="$SCRIPTPATH"
|
|
|
|
input="${dir}/output/node-packages.json"
|
|
|
|
output_dir="${dir}/output"
|
|
|
|
|
|
|
|
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-05-22 16:04:45 +00:00
|
|
|
{ "realm": "https://github.com/status-im/realm-js/archive/v2.20.1.tar.gz" }
|
2019-03-01 18:01:33 +00:00
|
|
|
]
|
|
|
|
EOF
|
|
|
|
|
|
|
|
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 \
|
|
|
|
-i $input \
|
2019-03-01 18:01:33 +00:00
|
|
|
-o $output_dir/node-packages.nix \
|
|
|
|
-c $output_dir/default.nix \
|
|
|
|
-e $output_dir/node-env.nix
|
|
|
|
rm $input
|