-
Notifications
You must be signed in to change notification settings - Fork 14
/
shell.nix
49 lines (46 loc) · 1.2 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
{ profile ? "stable", version ? "1.82.0" }:
let
sources = import ./nix/sources.nix;
pkgs = import sources.nixpkgs {
overlays = [ (_: _: { inherit sources; }) (import ./nix/overlay.nix { }) ];
};
rust = import sources.nixpkgs { overlays = [ (import sources.rust-overlay) ]; };
in
let
rust-bin =
(rust.rust-bin.${profile}.${version}.default.override {
extensions = [ "rust-src" ];
});
in
with pkgs;
pkgs.mkShell {
buildInputs = [
rust-bin
cacert
cargo-udeps
clang
openssl
pkg-config
pre-commit
protobuf
udev
util-linux
commitlint
git
];
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
PROTOC = "${protobuf}/bin/protoc";
PROTOC_INCLUDE = "${protobuf}/include";
NODE_PATH = "${nodePackages."@commitlint/config-conventional"}/lib/node_modules";
shellHook = ''
if [ -z "$CI" ] && [ "$IN_NIX_SHELL" = "impure" ]; then
pre-commit install
pre-commit install --hook commit-msg
fi
if [ -d ~/.cargo/bin ]; then
# Adding ~/.cargo/bin to the path let's us carry on using rustup but it lowers its
# priority: https://github.com/rust-lang/cargo/pull/11023
export PATH=$PATH:~/.cargo/bin
fi
'';
}