add shell.nix and .envrc for development under nix

This commit is contained in:
Vincent Breitmoser 2020-01-30 12:49:10 +01:00
parent 4e06734a1d
commit 2e1956fcfa
No known key found for this signature in database
GPG Key ID: 7BD18320DEADFA11
2 changed files with 33 additions and 0 deletions

1
.envrc Normal file
View File

@ -0,0 +1 @@
eval "$(lorri direnv)"

32
shell.nix Normal file
View File

@ -0,0 +1,32 @@
with import <nixpkgs> {};
let
src = fetchFromGitHub {
owner = "mozilla";
repo = "nixpkgs-mozilla";
# commit from: 2019-05-15
rev = "c482bfd3dab1bde9590b03e712d73ced15385be4";
sha256 = "18sxl0fxhbdnrfmkbmgxwsn12qy8dbv6ccb3imyyqbjqb76j8dpi";
};
in
with import "${src.out}/rust-overlay.nix" pkgs pkgs;
stdenv.mkDerivation {
name = "rust-env";
buildInputs = [
(rustChannelOf { rustToolchain = ./rust-toolchain; }).rust
# latest.rustChannels.nightly.rust
# latest.rustChannels.stable.rust
clang
gettext
nettle
pkgconfig
];
# Set Environment Variables
RUST_BACKTRACE = 1;
# compilation of -sys packages requires manually setting this :(
shellHook = ''
export LIBCLANG_PATH="${pkgs.llvmPackages.libclang}/lib";
'';
}