forked from dfinity/ic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell.nix
154 lines (124 loc) · 3.79 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
{ system ? builtins.currentSystem
, pkgs ? import ./nix { inherit system; }
}:
let
crateEnv = import ./rs/crate-environment.nix { inherit pkgs; };
honeycomb-beeline =
with pkgs.python3Packages;
buildPythonPackage rec {
pname = "honeycomb-beeline";
version = "3.2.0";
src = fetchPypi {
inherit pname version;
sha256 = "1aaxqp6d0dlg7yxzm602v9lv8rzlias625q542i45i3sw541bdxs";
};
# check phase depends on a bunch of commonly used python web frameworks
doCheck = false;
propagatedBuildInputs = [
wrapt
libhoney
];
};
libhoney =
with pkgs.python3Packages;
buildPythonPackage rec {
pname = "libhoney";
version = "2.0.0";
src = fetchPypi {
inherit pname version;
sha256 = "0i0s4lqpn04d2sm97llhanrpcljzygpr920kiynxahyqjfyk8qwy";
};
propagatedBuildInputs = [
mock
requests-mock
requests
six
statsd
tornado
];
};
in
(
pkgs.mkShell (
{
nobuildPhase = ''
echo
echo "This derivation is not meant to be built, aborting";
echo
touch $out
'';
nativeBuildInputs = [
# same tools for linux and darwin
pkgs.coreutils
pkgs.curl
pkgs.nc
# for vulnerability audit
pkgs.cargo-audit
pkgs.gnuplot
pkgs.jo
pkgs.nix-prefetch-git
# useful cargo utilities
pkgs.cargo-flamegraph
pkgs.cargo-expand
# used by rosetta-api
pkgs.rosetta-cli
# Protobuf conformance checking
pkgs.buf
# Third party package management
pkgs.niv
# For building Motoko canisters like nns/handlers/lifeline/lifeline.mo
pkgs.moc
# for minimizing wasm
pkgs.wabt
# For creating IC-OS config images and universal VM config images
# (./tests/create-universal-vm-config-image.sh)
pkgs.dosfstools
pkgs.mtools
pkgs.zstd
# dependencies for libusb-sys cargo library
pkgs.libusb
]
++ pkgs.lib.optionals pkgs.stdenv.isLinux [
# provides the `taskset` command, which we use to fix core affinity in the shell
pkgs.utillinux
pkgs.libselinux
pkgs.libunwind
# this tool is used by cargo-flamegraph
pkgs.linuxPackages.perf
# A rust code-coverage tool: https://github.com/xd009642/tarpaulin
pkgs.cargo-tarpaulin
# dependencies for coverage.py
pkgs.kcov
pkgs.python3Packages.toml
] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
# used for honeycomb traces in CI scripts
honeycomb-beeline
];
buildInputs = [
# Needed by gitlab-ci/src/test_results/summary.py
pkgs.python3Packages.termcolor
pkgs.python3Packages.requests
pkgs.python3Packages.paramiko
pkgs.python3Packages.tqdm
];
RUST_SRC_PATH = pkgs.rustPlatform.rustcSrc;
# Only applicable to nix-shell users, remember to update the production value in:
# ic-os/guestos/rootfs/etc/systemd/system/ic-replica.service
RUST_MIN_STACK = 8192000;
CARGO_BUILD_TARGET = pkgs.stdenv.hostPlatform.config;
CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_LINKER = "${pkgs.llvmPackages_11.lld}/bin/lld";
# Support up to 256 cores/threads
shellHook =
pkgs.lib.optionalString pkgs.stdenv.isLinux ''
taskset -acp 0-255 $$
'' + ''
if (( $(ulimit -n) < 8192 )); then
ulimit -n 8192
fi
if ! hash rustup 2>/dev/null; then
echo >&2 "Warning: The IC nix-shell no longer provides rustc. Please install rustup using the instructions at https://rustup.rs/."
fi
'';
}
)
).overrideAttrs crateEnv