forked from EspressoSystems/jellyfish
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell.nix
45 lines (34 loc) · 1.06 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
let
basePkgs = import ./nix/nixpkgs.nix { };
rust_overlay = with basePkgs; import (fetchFromGitHub
(lib.importJSON ./nix/oxalica_rust_overlay.json));
pkgs = import ./nix/nixpkgs.nix { overlays = [ rust_overlay ]; };
nightlyToolchain = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal.override {
extensions = [ "rustfmt" ];
});
stableToolchain = pkgs.rust-bin.stable."1.56.1".minimal.override {
extensions = [ "clippy" "llvm-tools-preview" "rust-src" ];
};
pre-commit-check = pkgs.callPackage ./nix/pre-commit.nix { };
in
with pkgs;
mkShell {
buildInputs = [
argbash
openssl
pkgconfig
git
stableToolchain
nightlyToolchain
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
];
shellHook = ''
export RUST_BACKTRACE=full
export PATH="$PATH:$(pwd)/target/debug:$(pwd)/target/release"
# Ensure `cargo fmt` uses `rustfmt` from nightly.
export RUSTFMT="${nightlyToolchain}/bin/rustfmt"
# install pre-commit hooks
${pre-commit-check.shellHook}
'';
}