This repository has been archived by the owner on Nov 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
flake.nix
85 lines (70 loc) · 2.89 KB
/
flake.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
{
description = "Flake for development workflows.";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
rainix.url = "github:rainprotocol/rainix";
};
outputs = {self, rainix, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = rainix.pkgs.${system};
in rec {
packages = rec{
network-list = rainix.network-list.${system};
networks = pkgs.lib.concatStringsSep " " network-list;
check-deployer-words = rainix.mkTask.${system} {
name = "check-deployer-words";
body = ''
set -euxo pipefail
# The path to the rain files.
dotrain_folder_path=''${DOTRAIN_FOLDER_PATH:-.}
# Get all the rain files in the sub folders.
dotrain_paths=""
for folder in "$dotrain_folder_path"/*; do
if [ -d "$folder" ]; then
dotrain=$(find "$folder" -type f -name "*.rain" -print)
dotrain_paths+=" $dotrain"
fi
done
# Get all the rain files in the current folder.
for dotrain in "$dotrain_folder_path"/*.rain ; do
dotrain_paths+=" $dotrain"
done
# Remove leading and trailing whitespace.
dotrain_paths=$(echo "$dotrain_paths" | tr -s ' ' | sed 's/^ //;s/ $//')
# Exclude paths.
exclude_paths=''${DOTRAIN_EXCLUDE_PATHS:-}
# Remove the excluded paths.
for exclude_path in $exclude_paths; do
dotrain_paths=$(echo "$dotrain_paths" | tr ' ' '\n' | grep -v "$exclude_path" | tr '\n' ' ')
done
for dotrain in $dotrain_paths
do
echo "Checking deployments within $dotrain"
deployment_keys=$( \
cargo run --manifest-path ''${MANIFEST_PATH} --package rain_orderbook_cli \
order keys \
-f $dotrain ''${SETTINGS_PATH:+-c "''${SETTINGS_PATH}"} \
)
for key in $deployment_keys
do
echo "key: $key"
cargo run --manifest-path ''${MANIFEST_PATH} \
--package rain_orderbook_cli \
words -f $dotrain ''${SETTINGS_PATH:+-c "''${SETTINGS_PATH}"} --deployment "$key" --stdout
done
done
'';
};
} // rainix.packages.${system};
devShells.default = pkgs.mkShell {
packages = [
packages.check-deployer-words
];
shellHook = rainix.devShells.${system}.default.shellHook;
buildInputs = rainix.devShells.${system}.default.buildInputs;
nativeBuildInputs = rainix.devShells.${system}.default.nativeBuildInputs;
};
}
);
}