This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
shell.nix
68 lines (59 loc) · 1.73 KB
/
shell.nix
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
let
pkgs = import
(builtins.fetchTarball {
name = "nixos-unstable-2021-10-01";
url = "https://github.com/nixos/nixpkgs/archive/0f33d439a715688605402a450fba0382b658d581.tar.gz";
sha256 = "1nfz3z8dx5rbs6y6w35rrhbxb9sw70zkc5mr7g5k5rx3mqg5wp1x";
})
{ };
generate-docs = pkgs.writeShellScriptBin "generate-docs" ''
yarn generate-docs
# Remove issues with missing close tags and customize the output
find ./docs/ -name "*.md" -exec sed -i -r -e 's/<br><br>/<br><\/br>/g; s/<i>|<\/i>/*/g' -e '1d' docs/index.md {} +
sed -i 's/rain-sdk/SDK/' docs/index.md
'';
lint-sdk = pkgs.writeShellScriptBin "lint-sdk" ''
yarn lint
'';
build-sdk = pkgs.writeShellScriptBin "build-sdk" ''
copy-typechain
yarn build
generate-docs
'';
test-sdk = pkgs.writeShellScriptBin "test-sdk" ''
yarn build
yarn test
'';
copy-contracts = pkgs.writeShellScriptBin "copy-contracts" ''
mkdir -p contracts && cp -r node_modules/@beehiveinnovation/rain-protocol/contracts .
mkdir -p contracts/rain-statusfi && cp node_modules/@beehiveinnovation/rain-statusfi/contracts/*.sol contracts/rain-statusfi
hardhat compile --no-typechain
'';
generate-typechain = pkgs.writeShellScriptBin "generate-typechain" ''
hardhat typechain
rm -rf src/typechain && mkdir -p src/typechain
cp -r typechain src
'';
copy-typechain = pkgs.writeShellScriptBin "copy-typechain" ''
copy-contracts && generate-typechain
'';
in
pkgs.stdenv.mkDerivation {
name = "shell";
buildInputs = [
pkgs.yarn
pkgs.nodejs-14_x
copy-contracts
generate-typechain
copy-typechain
generate-docs
lint-sdk
build-sdk
test-sdk
];
shellHook = ''
export PATH=$( npm bin ):$PATH
# keep it fresh
yarn install --ignore-scripts && build-sdk
'';
}