forked from openebs/mayastor-extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell.nix
70 lines (65 loc) · 2.25 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
{ norust ? false, devrustup ? true, rust-profile ? "nightly" }:
let
sources = import ./nix/sources.nix;
pkgs = import sources.nixpkgs {
overlays = [ (_: _: { inherit sources; }) (import ./nix/overlay.nix { }) (import sources.rust-overlay) ];
};
in
with pkgs;
let
norust_moth =
"You have requested an environment without rust, you should provide it!";
devrustup_moth =
"You have requested an environment for rustup, you should provide it!";
channel = import ./nix/lib/rust.nix { inherit pkgs; };
rust_chan = channel.default_src;
rust = rust_chan.${rust-profile};
in
mkShell {
name = "extensions-shell";
buildInputs = [
cacert
cargo-expand
cargo-udeps
clang
commitlint
cowsay
git
helm-docs
kubernetes-helm-wrapped
llvmPackages.libclang
niv
nixpkgs-fmt
openapi-generator
openssl
pkg-config
pre-commit
python3
semver-tool
utillinux
which
yq-go
] ++ pkgs.lib.optional (!norust) channel.default_src.nightly
++ pkgs.lib.optional (system == "aarch64-darwin") darwin.apple_sdk.frameworks.Security;
PROTOC = "${protobuf}/bin/protoc";
PROTOC_INCLUDE = "${protobuf}/include";
NODE_PATH = "${nodePackages."@commitlint/config-conventional"}/lib/node_modules";
# using the nix rust toolchain
USE_NIX_RUST = "${toString (!norust)}";
# copy the rust toolchain to a writable directory, see: https://github.com/rust-lang/cargo/issues/10096
# the whole toolchain is copied to allow the src to be retrievable through "rustc --print sysroot"
RUST_TOOLCHAIN = ".rust-toolchain/${rust.version}";
RUST_TOOLCHAIN_NIX = "${rust}";
shellHook = ''
./scripts/nix/git-submodule-init.sh
pre-commit install
pre-commit install --hook commit-msg
export EXTENSIONS_SRC=`pwd`
export CTRL_SRC="$EXTENSIONS_SRC"/dependencies/control-plane
export PATH="$PATH:$(pwd)/target/debug"
${pkgs.lib.optionalString (norust) "cowsay ${norust_moth}"}
${pkgs.lib.optionalString (norust) "echo"}
rust_version="${rust.version}" rustup_channel="${lib.strings.concatMapStringsSep "-" (x: x) (lib.lists.drop 1 (lib.strings.splitString "-" rust.version))}" \
dev_rustup="${toString (devrustup)}" devrustup_moth="${devrustup_moth}" . "$CTRL_SRC"/scripts/rust/env-setup.sh
'';
}