-
Notifications
You must be signed in to change notification settings - Fork 4
/
shell.nix
63 lines (58 loc) · 1.57 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
{ localSystem ? builtins.currentSystem
, crossSystem ? null
}:
let
pkgs = import ./utils/nixpkgs.nix {
inherit localSystem crossSystem;
};
in
pkgs.mkShell {
nativeBuildInputs = with pkgs.pkgsBuildHost; [
# Setup rust
(rust-bin.fromRustupToolchainFile ./rust-toolchain.toml)
# Will add some dependencies like libiconv
rustBuildHostDependencies
# Linters
nixpkgs-fmt
shellcheck
# Useful utilites
ldproxy
# Cache llvm stdenv on gcc platforms
(pkgs.hello.override { stdenv = llvmPackages.libcxxStdenv; })
# Cargo tests runner
(writeShellScriptBin "cargo-tests.sh" ''
cargo clean --manifest-path "tests/crates/Cargo.toml" "$@"
cargo build --manifest-path "tests/crates/Cargo.toml" "$@"
'')
]
# Build also all cargo deps
++ pkgs.cargoDeps.all;
buildInputs = with pkgs; [
# Enable Rust cross-compilation support
rustCrossHook
# List of tested native libraries
icu
coreutils
bash
toml11
nano
] ++ lib.optionals (!stdenv.targetPlatform.isMusl) [
msgpack-cxx
boost178
];
shellHook = "${pkgs.crossBashPrompt}";
# Minimal shell for partialy supported targets.
passthru.minimalShell = pkgs.mkShell {
nativeBuildInputs = with pkgs.pkgsBuildHost; [
# Setup rust
(rust-bin.fromRustupToolchainFile ./rust-toolchain.toml)
# Will add some dependencies like libiconv
rustBuildHostDependencies
];
buildInputs = with pkgs; [
# Enable Rust cross-compilation support
rustCrossHook
];
shellHook = "${pkgs.crossBashPrompt}";
};
}