forked from openebs/mayastor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell.nix
68 lines (64 loc) · 1.69 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
{ nospdk ? false }:
let
sources = import ./nix/sources.nix;
pkgs = import sources.nixpkgs {
overlays =
[ (_: _: { inherit sources; }) (import ./nix/mayastor-overlay.nix) ];
};
in
with pkgs;
let
nospdk_moth =
"You have requested environment without SPDK, you should provide it!";
norust_moth =
"You have requested environment without RUST, you should provide it!";
channel = import ./nix/lib/rust.nix { inherit sources; };
# python environment for test/python
pytest_inputs = python3.withPackages
(ps: with ps; [ virtualenv grpcio grpcio-tools asyncssh black ]);
in
mkShell {
name = "mayastor-dev-shell";
# fortify does not work with -O0 which is used by spdk when --enable-debug
hardeningDisable = [ "fortify" ];
buildInputs = [
clang_11
cowsay
etcd
fio
libaio
libbsd
libnvme
libpcap
libudev
liburing
llvmPackages_11.libclang
meson
ninja
nodejs-16_x
nvme-cli
numactl
openssl
pkg-config
pre-commit
procps
pytest_inputs
python3
utillinux
] ++ (if (nospdk) then [ libspdk-dev.buildInputs ] else [ libspdk-dev ]);
LIBCLANG_PATH = mayastor.LIBCLANG_PATH;
PROTOC = mayastor.PROTOC;
PROTOC_INCLUDE = mayastor.PROTOC_INCLUDE;
SPDK_PATH = if nospdk then null else "${libspdk-dev}";
shellHook = ''
${pkgs.lib.optionalString (nospdk) "cowsay ${nospdk_moth}"}
${pkgs.lib.optionalString (nospdk) "export CFLAGS=-msse4"}
${pkgs.lib.optionalString (nospdk) "echo"}
echo 'Hint: use rustup tool.'
echo
# SRCDIR is needed by docker-compose files as it requires absolute paths
export SRCDIR=`pwd`
pre-commit install
pre-commit install --hook commit-msg
'';
}