Minor Nix environent tweaks (#209)

* envrc: made lorri optional

* shell.nix: added RUST_SRC_PATH, so rust-analyzer works out of the box
main
Vladimir Serov 2021-07-03 08:38:32 +03:00 committed by GitHub
parent e54c97edd8
commit 32039ccbb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 6 deletions

9
.envrc
View File

@ -1,2 +1,7 @@
use_nix
eval "$(lorri direnv)"
# If lorri exists, better try it first.
if has lorri; then
eval "$(lorri direnv)"
else
# Otherwise fall back to pure nix
use nix
fi

View File

@ -6,7 +6,6 @@ let
});
pinned = builtins.fetchGit {
# Descriptive name to make the store path easier to identify
name = "nixos-unstable-2020-04-26";
url = "https://github.com/nixos/nixpkgs/";
# Commit hash for nixos-unstable as of 2020-04-26
# `git ls-remote https://github.com/nixos/nixpkgs nixos-unstable`
@ -14,20 +13,23 @@ let
rev = "1fe6ed37fd9beb92afe90671c0c2a662a03463dd";
};
nixpkgs = import pinned { overlays = [ mozillaOverlay ]; };
rust-nightly = with nixpkgs; ((rustChannelOf { date = "2021-03-01"; channel = "nightly"; }).rust.override {
toolchain = with nixpkgs; (rustChannelOf { date = "2021-03-01"; channel = "nightly"; });
rust-wasm = toolchain.rust.override {
targets = [ "wasm32-unknown-unknown" ];
});
};
in
with nixpkgs; pkgs.mkShell {
buildInputs = [
clang
pkg-config
rust-nightly
rust-wasm
] ++ stdenv.lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
];
LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
PROTOC = "${protobuf}/bin/protoc";
RUST_SRC_PATH = "${toolchain.rust-src}/lib/rustlib/src/rust/library/";
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
}