forked from wormhole-foundation/wormhole
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell.nix
100 lines (100 loc) · 3.03 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
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
{ sources ? import nix/sources.nix # Please specify inputs obtained from `sources` as separate params like below
, cargo2nix ? sources.cargo2nix
, nixpkgs ? sources.nixpkgs
, rust-olay ? import sources.rust-overlay
}:
let
tilt-olay = self: super: {
tilt184 = self.tilt.overrideAttrs (
oldAttrs: {
version = "0.18.4";
src = self.fetchFromGitHub {
owner = "tilt-dev";
repo = oldAttrs.pname;
rev = "v0.18.4";
sha256 = null;
};
buildFlagsArray = [ "-ldflags=-X main.version=0.18.4" ];
}
);
};
scripts-olay = self: super: {
whcluster = self.writeShellScriptBin "whcluster" ''
set -e
default_minikube_args="--cpus=10 --memory=10gb --disk-size=200gb"
export MINIKUBE_ARGS=''${MINIKUBE_ARGS:-$default_minikube_args}
${self.minikube}/bin/minikube start $MINIKUBE_ARGS
${self.minikube}/bin/minikube ssh 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p'
${self.whkube}/bin/whkube
'';
whkube = self.writeShellScriptBin "whkube" ''${self.kubectl}/bin/kubectl config set-context --current --namespace=wormhole'';
whtilt = self.writeShellScriptBin "whtilt" ''
echo "Starting Tilt with ''${1:=5} guardians"
${self.tilt184}/bin/tilt up --update-mode exec -- --num=$1
'';
whinotify = self.writeShellScriptBin "whinotify" ''
${self.minikube}/bin/minikube ssh 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p'
'';
# stan-work config
whsw = self.writeShellScriptBin "whsw" ''
${pkgs.mutagen}/bin/mutagen sync terminate whsw-sync || true
${pkgs.mutagen}/bin/mutagen sync create -n whsw-sync . stan-work:~/wormhole
${pkgs.mutagen}/bin/mutagen sync flush whsw-sync
export MINIKUBE_ARGS='--cpus=30 --memory=110g --disk-size=1000gb'
ssh stan-work \
". ~/.zprofile && \
cd wormhole && \
nix-shell --command ' MINIKUBE_ARGS=\"$MINIKUBE_ARGS\" whcluster && \
killall tilt || true'"
ssh -L 10350:127.0.0.1:10350 stan-work \
"cd wormhole && \
source ~/.zprofile && \
nix-shell shell.nix --command 'whtilt $WH_GUARDIAN_COUNT'"
'';
};
cargo2nix-olay = import "${cargo2nix}/overlay";
pkgs = import nixpkgs {
overlays = [
# cargo2nix-olay
rust-olay
tilt-olay
scripts-olay
];
};
cargo2nix-drv = import cargo2nix {
inherit nixpkgs;
};
in
pkgs.mkShell {
nativeBuildInputs = (
with pkgs; [
go
gopls
hidapi
libudev
openssl
pkgconfig
protobuf
whcluster
whinotify
whkube
whtilt
whsw
# (
# rust-bin.stable."1.51.0".default.override {
# extensions = [
# "rust-src"
# "rust-analysis"
# ];
# }
# )
# Provided on Fedora:
kubectl
minikube
tilt184
# xargo
]
);
DOCKER_BUILDKIT = 1;
PROTOC = "${pkgs.protobuf}/bin/protoc";
}