Skip to content

Commit

Permalink
Get Nix Pilled (#1073)
Browse files Browse the repository at this point in the history
* use nix flake to lock build toolchains such as yarn, foundry, ghc, etc.

* added nodejs 16 to dependencies

* add flakes/whitehat

* add flakes/whitehat

* devShells

* remove haskell tools

* [SDK-CORE] 0.5.6 Patch Fix (#1074)

* fix subgraphAPIEndpoint for sdk-core

* Update constants.ts

* third time is the charm

* Update 5_subgraph.test.ts

* proper env variable name

* Update yarn.lock

* address comments

* isArbGoerli

* updated contributing

* typo

Co-authored-by: 0xdavinchee <0xdavinchee@gmail.com>
  • Loading branch information
hellwolf and 0xdavinchee authored Sep 8, 2022
1 parent 5f536a8 commit ca3893e
Show file tree
Hide file tree
Showing 9 changed files with 386 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/.yarn/releases/** binary
/.yarn/plugins/** binary
*.sol linguist-language=Solidity
23 changes: 23 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,29 @@ Before interacting with the Superfluid community, please read and understand our

## Local Development

### Setup Tooling

At minimum, you will need to have these available in your development environment:

- yarn, sufficiently recent version, the actual yarn version is locked in yarnc.
- nodejs 16.x.

**More Options Using Nix**

You may also use [nix package manager](https://nixos.org/download.html) to get a reproducible, declarative and reliable development environment.

Development shells options are available under `devShells` folder ([nix flakes](https://nixos.wiki/wiki/Flakes) required):

- minimum, minimum development environment for building monorepo.
- whitehat, additional ethereum development toolings including slither, echidna, etc.
- spec, for developing of Superfluid haskell spec.

To use them:

- `nix develop path:flakes/minimum` or `npm run shell`
- `nix develop path:flakes/whitehat` or `npm run shell:whitehat`
- `nix develop path:flakes/spec` or `npm run shell:spec`

### Installing Dependencies

Before you do anything, you should run `yarn install && yarn build` in the root directory of your local-copy of the protocol-monorepo to install and build the necessary dependencies.
Expand Down
94 changes: 94 additions & 0 deletions devShells/minimum/flake.lock

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

26 changes: 26 additions & 0 deletions devShells/minimum/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
description = "The minimum development environment for working with the Superfluid protocol monorepo";


inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flakeUtils.url = "github:numtide/flake-utils";
foundry.url = "github:shazow/foundry.nix";
};

outputs = { self, nixpkgs, flakeUtils, foundry } :
flakeUtils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in {
devShell = with pkgs; mkShell {
buildInputs = [
# for nodejs ecosystem
yarn
nodejs-16_x
# for solidity development
foundry.defaultPackage.${system}
];
};
});
}
43 changes: 43 additions & 0 deletions devShells/spec/flake.lock

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

24 changes: 24 additions & 0 deletions devShells/spec/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flakeUtils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flakeUtils }:
flakeUtils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in {
devShell = with pkgs; mkShell {
buildInputs = [
# for nodejs ecosystem
yarn
gnumake
nodePackages.nodemon
# for haskell spec
haskell.compiler.ghc924
haskell-language-server
];
};
});
}
144 changes: 144 additions & 0 deletions devShells/whitehat/flake.lock

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

26 changes: 26 additions & 0 deletions devShells/whitehat/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flakeUtils.url = "github:numtide/flake-utils";
foundry.url = "github:shazow/foundry.nix";
echidna.url = "github:crytic/echidna";
};

outputs = { self, nixpkgs, flakeUtils, foundry, echidna }:
flakeUtils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in {
devShell = with pkgs; mkShell {
buildInputs = [
# for nodejs ecosystem
yarn
nodejs-16_x
# for solidity development
foundry.defaultPackage.${system}
slither-analyzer
echidna.defaultPackage.${system}
];
};
});
}
Loading

0 comments on commit ca3893e

Please sign in to comment.