Skip to content

Commit

Permalink
Merge pull request #67 from near/dmd/nix-dev-env
Browse files Browse the repository at this point in the history
Added a nix dev env for faster integration test turnaround
  • Loading branch information
volovyks authored Apr 18, 2023
2 parents cf80acd + dcfefdb commit 6d8ebb6
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
use flake 'github:DavidM-D/workspaces?dir=rust'
use flake .
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ git submodule update --init --recursive
docker build . -t near/mpc-recovery
```

alternatively if you have [nix](https://nixos.org/) and [direnv](https://direnv.net/) installed, you can set up a development environment by running:

``` BASH
direnv allow
```

Run tests with:
```
cargo test -p mpc-recovery
Expand Down
130 changes: 130 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This is a simple deterministic rust development environment
# This exposes Cargo, rustfmt, rust-analyzer and clippy
# This does not allow you to build binaries using nix
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, flake-utils, rust-overlay, ... }:

flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };

# Pick what rust compiler to use
in {
devShell = pkgs.mkShell {

# Everything in this list is added to your path
buildInputs =
with pkgs; [
darwin.apple_sdk.frameworks.Security
protobuf
];
};
});
}

0 comments on commit 6d8ebb6

Please sign in to comment.