-
Notifications
You must be signed in to change notification settings - Fork 15
/
cross-shell.nix
33 lines (30 loc) · 1.03 KB
/
cross-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
# A simplest nix shell file with the project dependencies and
# a cross-compilation support.
{ pkgs, RUSTFLAGS, RUST_LOG, RUST_LOG_FORMAT, RUST_BACKTRACE }:
pkgs.mkShell rec {
# Native project dependencies like build utilities and additional routines
# like container building, linters, etc.
nativeBuildInputs = with pkgs.pkgsBuildHost; [
# Rust
(rust-bin.stable.latest.minimal.override {
extensions = [ "rustfmt" "clippy" "llvm-tools-preview" "rust-src" ];
})
# Will add some dependencies like libiconv
rustBuildHostDependencies
# Crate dependencies
cargoDeps.openssl-sys
protobuf # required by libp2p
openssh
];
# Libraries essential to build the service binaries
buildInputs = with pkgs; [
# Enable Rust cross-compilation support
rustCrossHook
];
shellHook = ''
# Prevent cargo aliases from using programs in `~/.cargo` to avoid conflicts
# with rustup installations.
export CARGO_HOME=$HOME/.cargo-nix
'';
inherit RUSTFLAGS RUST_LOG RUST_LOG_FORMAT RUST_BACKTRACE;
}